@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)
CustomerService
byToken
in interface CustomerService
token
- the tokenpublic CustomerToken createPasswordResetToken(java.lang.String email)
CustomerService
The 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 CustomerService
email
- Email address for which the token should be created.public play.libs.F.Promise<SphereResult<CustomerToken>> createPasswordResetTokenAsync(java.lang.String email)
CustomerService
createPasswordResetTokenAsync
in interface CustomerService
email
- Email address for which the token should be created.createPasswordResetToken
public Customer resetPassword(VersionedId customerId, java.lang.String token, java.lang.String newPassword)
CustomerService
resetPassword
in interface CustomerService
token
- 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)
CustomerService
resetPasswordAsync
in interface CustomerService
token
- A token that was previously generated using the
createPasswordResetToken
method.newPassword
- New plaintext password to be set for the customer.