showPasswordEditor
client.showPasswordEditor({ container: HTMLElement|id, // Optional arguments accessToken: string, showLabels: boolean, promptOldPassword: boolean, onReady: function, onSuccess: function, onError: function, theme: object, i18n: object, })
Description
Show the widget allowing the current profile to edit his password after email validation.
You have to pass the profile’s access token retrieved after authentication.
Examples
import { ErrorResponse } from '@reachfive/identity-ui'
const accessToken = // Here paste the authorization token of the profile retrieved after login
// Update the password with the access token
client.showPasswordEditor({
container: 'password-editor-container',
accessToken,
showLabels: true,
promptOldPassword: true,
onReady: instance => {
// Destroy the widget
// if (...) instance.destroy()
},
onSuccess: () => {
// Handle the password update success
console.log('Password successfully updated!')
},
onError: (error: ErrorResponse) => {
// Handle the password update error
console.error(error)
},
theme: {
primaryColor: '#274890',
borderRadius: '#374890'
},
i18n: {
newPassword: 'Your new password',
oldPassword: 'Your old password',
passwordConfirmation: 'Confirm your new password'
}
})
Parameters
The DOM element or the |
|||||||||
The profile’s access token. |
|||||||||
Boolean for whether the signup form fields' labels are displayed on the login view. Defaults to |
|||||||||
Ask for the old password before entering a new one. Defaults to |
|||||||||
Callback function called after the widget has been successfully loaded and rendered inside the container. The callback is called with the widget instance. |
|||||||||
Callback function called when the request was successful. |
|||||||||
Callback function called when the request has failed. |
|||||||||
The options to set up to customize the appearance of the widget. Below is an example of some of the theme attributes. For a full list, see theme attributes.
|
|||||||||
Widget labels and error messages to override. Falls back to the default wordings in
|
theme
attributes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|