How Users Edit their Email and Password Front End
These features allow users to change the key information that identifies them on your site.
- Users must remember their existing password
- Users must be already logged in
- A Secure Zone must be added to the Form- but this can be an "account" Secure zone which the User already belongs to.
This Article shows how Users who remember their Email address and Password can change these using a Form. If you need a feature for Users who have forgotten their password, try the Password Reset feature.
Create a Form which will be used to update Users' email address or password.
This Form should have a Secure Zone attached- but this can be an existing Secure Zone that you use for Accounts e.g. "My Account" or an equivalent.
You do not need to add any custom fields in the Siteglide Admin in order to use this feature. Instead, the feature will be added solely in the Form Layout. You may wish to use one Form for updating an email and a separate Form for updating password. This is fine- just adjust these instructions accordingly.
We'll need to modify the Form Layout, so head to Code Editor and create a new Form Layout liquid file. This should be in the same folder as the Form you created in step 1.
You can add your Form to any Page.
Select your Custom Form Layout you made in step 2.
Editing email and password will only work if the User is already logged in. We recommend adding a Secure Zone to your Page to ensure this is the case.
In this step we'll be adding fields to the Form Layout which will allow the User to submit new email and password values. Pay close attention to the IDs of these elements, as this is what Siteglide will use to identify them.
Purpose - In this field the User will submit a new value for their email address.
Purpose - In this field the User will submit a new value for their password.
On most Siteglide Forms you'll see an email address and password fields with the HTML ID s_email and s_password. These fields are specifically used for Users to enter their current email address and password. Notice that the fields below we use for Users to provide new values for their email and password use different IDs s_email_edit and s_password_edit.
Remember, you do not need to use a single Form to edit both email and password. You can include these on separate Forms if you wish. You can use custom JavaScript to show or hide the fields when needed. Only when a value is given to the fields will they validate and throw an error if there is a mistake. Things to check at the end of this step:
- The ID attribute of each field will need to be exactly the same as that used in the documentation in order to work.
- The fields should not have an HTML name attribute. This is because we don't wish the information to be stored in the Case along with other custom fields.
In order to use this feature the User must:
- be already logged in
- enter their existing password again
In this step then, we make sure we are giving the User the opportunity to re-enter their password:
The Form Default Layout already includes this Field- however it is hidden from Users who are logged in. The simplest way to complete the step is to remove the logic:
Things to Check
- Make sure any <label> tags clearly show which field should be used for current password and which should be used for the new password.
- Make sure the current password field is only included once in the Form Layout
The last thing the User wishes to do is to reset their password to the wrong value. To provide extra validation, you can add confirmation fields:
Once you've added a confirmation field, our validation will make sure the email fields match and that the password fields match. If you choose not to add a confirmation field, it will not be required.
To help the User's browser to understand the difference between current and new password fields, you could add values to the autocomplete attribute:
- autocomplete="current-password"
- autocomplete="new-password"
And you're done!
You can use this feature along with our other Front-End CRM features to give Users control over their Data and Credentials on your Site.