Changeset 1712


Ignore:
Timestamp:
Apr 6, 2011, 11:36:21 AM (6 years ago)
Author:
robert@…
Message:

Solved user registration bugs: changing password didn't work and lost password form resulted in an error

Location:
trunk/grails-app/controllers/dbnp/authentication
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/authentication/RegisterController.groovy

    r1430 r1712  
    5656                }
    5757
    58                 def registrationCode = new RegistrationCode(username: user.username).save()
    59 
     58                def registrationCode = new RegistrationCode(username: user.username, expiryDate: new Date() + 1 )
     59                if( !registrationCode.save() ) {
     60                        println registrationCode.errors
     61                        flash.userError = "Your password could not be reset because of database errors. Please contact the system administrator."
     62                        return
     63                }
     64               
    6065                String url = generateLink('resetPassword', [t: registrationCode.token])
    6166
  • trunk/grails-app/controllers/dbnp/authentication/UserRegistrationController.groovy

    r1688 r1712  
    239239                String salt = user.username
    240240                RegistrationCode.withTransaction { status ->
    241                         user.password = springSecurityService.encodePassword(command.password, salt)
     241                        if( command.password != "" )
     242                                user.password = springSecurityService.encodePassword(command.password, salt)
    242243                        user.email = command.email
    243244                        user.save()
     
    274275                                (!password.matches('^.*\\p{Alpha}.*$') ||
    275276                                !password.matches('^.*\\p{Digit}.*$') ||
    276                                 !password.matches('^.*[!@#$%^&].*$'))) {
     277                                !password.matches('^.*[!@#$%+^&].*$'))) {
    277278                        return 'command.password.error.strength'
    278279                }
Note: See TracChangeset for help on using the changeset viewer.