Search in sources :

Example 1 with PasswordUpdatedHandler

use of org.broadleafcommerce.profile.core.service.handler.PasswordUpdatedHandler in project BroadleafCommerce by BroadleafCommerce.

the class CustomerServiceImpl method resetPassword.

@Override
@Transactional(TransactionUtils.DEFAULT_TRANSACTION_MANAGER)
public Customer resetPassword(PasswordReset passwordReset) {
    Customer customer = readCustomerByUsername(passwordReset.getUsername());
    String newPassword = PasswordUtils.generateSecurePassword(passwordReset.getPasswordLength());
    customer.setUnencodedPassword(newPassword);
    customer.setPasswordChangeRequired(passwordReset.getPasswordChangeRequired());
    customer = saveCustomer(customer);
    for (PasswordUpdatedHandler handler : passwordResetHandlers) {
        handler.passwordChanged(passwordReset, customer, newPassword);
    }
    return customer;
}
Also used : Customer(org.broadleafcommerce.profile.core.domain.Customer) PasswordUpdatedHandler(org.broadleafcommerce.profile.core.service.handler.PasswordUpdatedHandler) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with PasswordUpdatedHandler

use of org.broadleafcommerce.profile.core.service.handler.PasswordUpdatedHandler in project BroadleafCommerce by BroadleafCommerce.

the class CustomerServiceImpl method changePassword.

@Override
@Transactional(TransactionUtils.DEFAULT_TRANSACTION_MANAGER)
public Customer changePassword(PasswordChange passwordChange) {
    Customer customer = readCustomerByUsername(passwordChange.getUsername());
    customer.setUnencodedPassword(passwordChange.getNewPassword());
    customer.setPasswordChangeRequired(passwordChange.getPasswordChangeRequired());
    customer = saveCustomer(customer);
    for (PasswordUpdatedHandler handler : passwordChangedHandlers) {
        handler.passwordChanged(passwordChange, customer, passwordChange.getNewPassword());
    }
    return customer;
}
Also used : Customer(org.broadleafcommerce.profile.core.domain.Customer) PasswordUpdatedHandler(org.broadleafcommerce.profile.core.service.handler.PasswordUpdatedHandler) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Customer (org.broadleafcommerce.profile.core.domain.Customer)2 PasswordUpdatedHandler (org.broadleafcommerce.profile.core.service.handler.PasswordUpdatedHandler)2 Transactional (org.springframework.transaction.annotation.Transactional)2