Password

A set of methods for handling password resets, recovery, and updates for user accounts.

forgot

Sends a password reset link to the passed email. emits the PelcroPasswordForgot DOM events when the response is returned successfully.

Example

window.Pelcro.password.forgot({
      email: "[email protected]",
}, (error, response) => {
  	if (error) {
    	return console.log("error", error.message);
    }
 
    const user = response.data;
    console.log(user);
})

reset

Used to finish the password reset flow to update the user's password. the required reset token can be found in the reset link's query parameters. which can be requested using the Pelcro.password.forgot function. emits the PelcroPasswordReset DOM events when the response is returned successfully.

Parameters

  • email (String)
  • password (String)
  • password_confirmation (String)
  • token (String)

Example

window.Pelcro.password.reset({
      email: "[email protected]",
      password: "123456",
      password_confirmation: "123456",
      token: "abc12345xyz"
}, (error, response) => {
  	if (error) {
    	return console.log("error", error.message);
    }
 
    const user = response.data;
    console.log(user);
})

update

update the current user's password. emits the PelcroPasswordUpdate DOM events when the response is returned successfully.

Example

window.Pelcro.password.update({
      old_password: "123456",
      new_password: "123abc",
      confirm_new_password: "123abc"
}, (error, response) => {
  	if (error) {
    	return console.log("error", error.message);
    }
 
    const user = response.data;
    console.log(user);
})