@Immutable public class CustomerServiceAdapter extends java.lang.Object implements CustomerService
Sphere.currentCustomer().| Constructor and Description |
|---|
CustomerServiceAdapter(CustomerService service) |
| Modifier and Type | Method and Description |
|---|---|
FetchRequest<Customer> |
byToken(java.lang.String token)
Finds a customer associated to given token.
|
CustomerToken |
createPasswordResetToken(java.lang.String email)
Creates a password reset token for a customer.
|
play.libs.F.Promise<SphereResult<CustomerToken>> |
createPasswordResetTokenAsync(java.lang.String email)
Creates a password reset token for a customer asynchronously.
|
Customer |
resetPassword(VersionedId customerId,
java.lang.String token,
java.lang.String newPassword)
Sets a new password for the current customer.
|
play.libs.F.Promise<SphereResult<Customer>> |
resetPasswordAsync(VersionedId customerId,
java.lang.String token,
java.lang.String newPassword)
Sets a new password for the current customer asynchronously.
|
public CustomerServiceAdapter(@Nonnull
CustomerService service)
public FetchRequest<Customer> byToken(java.lang.String token)
CustomerServicebyToken in interface CustomerServicetoken - the tokenpublic CustomerToken createPasswordResetToken(java.lang.String email)
CustomerServiceThe typical workflow is the following:
byToken and store customer's id and version
in hidden form fields.
resetPassword or
resetPasswordAsync
passing in the new password and the token
createPasswordResetToken in interface CustomerServiceemail - Email address for which the token should be created.public play.libs.F.Promise<SphereResult<CustomerToken>> createPasswordResetTokenAsync(java.lang.String email)
CustomerServicecreatePasswordResetTokenAsync in interface CustomerServiceemail - Email address for which the token should be created.createPasswordResetTokenpublic Customer resetPassword(VersionedId customerId, java.lang.String token, java.lang.String newPassword)
CustomerServiceresetPassword in interface CustomerServicetoken - A token that was previously generated using the
createPasswordResetToken method.newPassword - New plaintext password to be set for the customer.public play.libs.F.Promise<SphereResult<Customer>> resetPasswordAsync(VersionedId customerId, java.lang.String token, java.lang.String newPassword)
CustomerServiceresetPasswordAsync in interface CustomerServicetoken - A token that was previously generated using the
createPasswordResetToken method.newPassword - New plaintext password to be set for the customer.