public final class CustomerCreatePasswordTokenCommand extends CommandImpl<CustomerToken>
CustomerPasswordResetCommand
.
withUpdateableCustomer(client(), customer -> { final String email = customer.getEmail(); final CustomerToken token = client().executeBlocking(CustomerCreatePasswordTokenCommand.of(email)); final String tokenValue = token.getValue();//this may need to be sent by email to the customer final String newPassword = "newPassword"; final Customer updatedCustomer = client().executeBlocking(CustomerPasswordResetCommand.ofTokenAndPassword(tokenValue, newPassword)); final CustomerSignInResult signInResult = client().executeBlocking(CustomerSignInCommand.of(email, newPassword)); assertThat(signInResult.getCustomer().getId()) .describedAs("customer can sign in with the new password") .isEqualTo(customer.getId()); return updatedCustomer; });
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getEmail() |
Long |
getTtlMinutes() |
HttpRequestIntent |
httpRequestIntent()
Provides an http request intent, this does not include the execution of it.
|
protected com.fasterxml.jackson.databind.JavaType |
jacksonJavaType() |
static CustomerCreatePasswordTokenCommand |
of(String customerEmail) |
static CustomerCreatePasswordTokenCommand |
of(String customerEmail,
Long ttlMinutes) |
deserialize
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
canDeserialize
public static CustomerCreatePasswordTokenCommand of(String customerEmail)
public static CustomerCreatePasswordTokenCommand of(String customerEmail, @Nullable Long ttlMinutes)
protected com.fasterxml.jackson.databind.JavaType jacksonJavaType()
jacksonJavaType
in class CommandImpl<CustomerToken>
public HttpRequestIntent httpRequestIntent()
SphereRequest
public String getEmail()