Guest User

Untitled

a guest
Sep 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. @Transactional
  2. class RegisterService {
  3.  
  4. def saltSource
  5. def springSecurityUiService
  6. def grailsApplication
  7. def changePassword(RegistrationCode registrationCode, String password) {
  8.  
  9. String salt = saltSource instanceof NullSaltSource ? null : registrationCode.username
  10.  
  11. RegistrationCode.withTransaction { status ->
  12. String usernameFieldName = SpringSecurityUtils.securityConfig.userLookup.usernamePropertyName
  13. def user = User.findWhere((usernameFieldName): registrationCode.username)
  14. user.password = springSecurityUiService.encodePassword(password, salt)
  15. user.save()
  16. registrationCode.delete()
  17. }
  18. }
  19. }
Add Comment
Please, Sign In to add comment