Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Transactional
- class RegisterService {
- def saltSource
- def springSecurityUiService
- def grailsApplication
- def changePassword(RegistrationCode registrationCode, String password) {
- String salt = saltSource instanceof NullSaltSource ? null : registrationCode.username
- RegistrationCode.withTransaction { status ->
- String usernameFieldName = SpringSecurityUtils.securityConfig.userLookup.usernamePropertyName
- def user = User.findWhere((usernameFieldName): registrationCode.username)
- user.password = springSecurityUiService.encodePassword(password, salt)
- user.save()
- registrationCode.delete()
- }
- }
- }
Add Comment
Please, Sign In to add comment