\\
{toc}
h2. What is ChangePassword?
ChangePassword is a simple Snippet that is used in conjunction with [Login|Login.Login], allowing users to change their password. You can place it anywhere, and it will process a form you must provide and change the user's password.
h2. Usage
Simply create a Change Password form, and at the top of the page, put the snippet call. For example:
{code}
<h2>Change Password</h2>
[[!ChangePassword?
&submitVar=`change-password`
&placeholderPrefix=`cp.`
&validateOldPassword=`1`
&validate=`nospam:blank`
]]
<div class="updprof-error">[[!+cp.error_message]]</div>
<form class="form" action="[[~[[*id]]]]" method="post">
<input type="hidden" name="nospam" value="" />
<div class="ff">
<label for="password_old">Old Password
<span class="error">[[!+cp.error.password_old]]</span>
</label>
<input type="password" name="password_old" id="password_old" value="[[+cp.password_old]]" />
</div>
<div class="ff">
<label for="password_new">New Password
<span class="error">[[!+cp.error.password_new]]</span>
</label>
<input type="password" name="password_new" id="password_new" value="[[+cp.password_new]]" />
</div>
<div class="ff">
<label for="password_new_confirm">Confirm New Password
<span class="error">[[!+cp.error.password_new_confirm]]</span>
</label>
<input type="password" name="password_new_confirm" id="password_new_confirm" value="[[+cp.password_new_confirm]]" />
</div>
<div class="ff">
<input type="submit" name="change-password" value="Change Password" />
</div>
</form>
{code}
h3. ChangePassword Properties
ChangePassword comes with some default properties you can override. They are:
{table-plus:autoNumber=true}
||Name||Description||Default||
|submitVar|The var to check for to load the ChangePassword functionality. If empty or set to false, ChangePassword will process the form on all POST requests.|logcp-submit|
|fieldOldPassword|The field name of the old password field.|password_old|
|fieldNewPassword|The field name of the new password field.|password_new|
|fieldConfirmNewPassword|Optional. If set, the field name of the confirm password field, and will be checked against the new password field during submission.|password_new_confirm|
|preHooks|What scripts to fire, if any, after the form passes validation but before save. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.| |
|postHooks|What scripts to fire, if any, after the user has been registered. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.| |
|redirectToLogin|If a user is not logged in and accesses this Resource, redirect them to the Unauthorized Page.|1|
|reloadOnSuccess|If 1, the page will redirect to itself with a GET parameter to prevent double-postbacks. If 0, it will simply set a success placeholder.|1|
|successMessage|If reloadOnSuccess is set to 0, output this message in the \[prefix\].successMessage placeholder.| |
|placeholderPrefix|The prefix to use for all placeholders set by this snippet.|logcp.|
{table-plus}
h2. See Also
{pagetree:root=Login}
{scrollbar}
{toc}
h2. What is ChangePassword?
ChangePassword is a simple Snippet that is used in conjunction with [Login|Login.Login], allowing users to change their password. You can place it anywhere, and it will process a form you must provide and change the user's password.
h2. Usage
Simply create a Change Password form, and at the top of the page, put the snippet call. For example:
{code}
<h2>Change Password</h2>
[[!ChangePassword?
&submitVar=`change-password`
&placeholderPrefix=`cp.`
&validateOldPassword=`1`
&validate=`nospam:blank`
]]
<div class="updprof-error">[[!+cp.error_message]]</div>
<form class="form" action="[[~[[*id]]]]" method="post">
<input type="hidden" name="nospam" value="" />
<div class="ff">
<label for="password_old">Old Password
<span class="error">[[!+cp.error.password_old]]</span>
</label>
<input type="password" name="password_old" id="password_old" value="[[+cp.password_old]]" />
</div>
<div class="ff">
<label for="password_new">New Password
<span class="error">[[!+cp.error.password_new]]</span>
</label>
<input type="password" name="password_new" id="password_new" value="[[+cp.password_new]]" />
</div>
<div class="ff">
<label for="password_new_confirm">Confirm New Password
<span class="error">[[!+cp.error.password_new_confirm]]</span>
</label>
<input type="password" name="password_new_confirm" id="password_new_confirm" value="[[+cp.password_new_confirm]]" />
</div>
<div class="ff">
<input type="submit" name="change-password" value="Change Password" />
</div>
</form>
{code}
h3. ChangePassword Properties
ChangePassword comes with some default properties you can override. They are:
{table-plus:autoNumber=true}
||Name||Description||Default||
|submitVar|The var to check for to load the ChangePassword functionality. If empty or set to false, ChangePassword will process the form on all POST requests.|logcp-submit|
|fieldOldPassword|The field name of the old password field.|password_old|
|fieldNewPassword|The field name of the new password field.|password_new|
|fieldConfirmNewPassword|Optional. If set, the field name of the confirm password field, and will be checked against the new password field during submission.|password_new_confirm|
|preHooks|What scripts to fire, if any, after the form passes validation but before save. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.| |
|postHooks|What scripts to fire, if any, after the user has been registered. This can be a comma-separated list of hooks, and if the first fails, the proceeding ones will not fire. A hook can also be a Snippet name that will execute that Snippet.| |
|redirectToLogin|If a user is not logged in and accesses this Resource, redirect them to the Unauthorized Page.|1|
|reloadOnSuccess|If 1, the page will redirect to itself with a GET parameter to prevent double-postbacks. If 0, it will simply set a success placeholder.|1|
|successMessage|If reloadOnSuccess is set to 0, output this message in the \[prefix\].successMessage placeholder.| |
|placeholderPrefix|The prefix to use for all placeholders set by this snippet.|logcp.|
{table-plus}
h2. See Also
{pagetree:root=Login}
{scrollbar}