Changeset 73 for branches/TaskRewrite/src/grails-app/controllers
- Timestamp:
- Mar 14, 2009, 10:04:39 AM (16 years ago)
- Location:
- branches/TaskRewrite/src/grails-app/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TaskRewrite/src/grails-app/controllers/AppCoreController.groovy
r71 r73 10 10 //def allowedMethods = [delete:'POST', save:'POST', update:'POST'] 11 11 12 13 12 def home = { 14 13 } 15 14 16 15 def options = { 17 def principal = authenticateService.principal()18 println principal.getUsername()//get username19 println principal.getAuthorities()//get authorities()20 16 } 17 18 def changePassword = { 19 //def principal = authenticateService.principal() 20 //println principal.getAuthorities() 21 22 if (request.method == 'GET') { 23 def personInstance = Person.get(authenticateService.userDomain().id) 24 return [ personInstance : personInstance ] 25 } 26 27 if (request.method == 'POST') { 28 def personInstance = Person.get(authenticateService.userDomain().id) 29 30 personInstance.pass = params.pass 31 personInstance.password = authenticateService.encodePassword(personInstance.pass) 32 33 if (!personInstance.hasErrors() && personInstance.save()) { 34 //userCache.removeUserFromCache(personInstance.loginName) 35 flash.message = "Password changed successfully." 36 redirect(action:options) 37 } 38 else { 39 render(view:'changePassword',model:[personInstance:personInstance]) 40 } 41 } 42 } 43 21 44 22 45 @Secured(['ROLE_AppAdmin']) -
branches/TaskRewrite/src/grails-app/controllers/LoginController.groovy
r59 r73 49 49 def auth = { 50 50 51 nocache response51 nocache(response) 52 52 53 53 if (isLoggedIn()) { -
branches/TaskRewrite/src/grails-app/controllers/PersonController.groovy
r72 r73 96 96 } 97 97 98 def oldPassword = person.password99 98 person.properties = params 100 if (!params.password.equals(oldPassword)) { 101 person.password = authenticateService.encodePassword(params.password) 102 } 103 if (person.save()) { 104 Authority.findAll().each { it.removeFromPersons(person) } 105 addRoles(person) 106 redirect action: show, id: person.id 107 } 108 else { 109 render view: 'edit', model: buildPersonModel(person) 110 } 99 100 if (person.pass != "") { 101 if (!person.hasErrors()) { 102 person.password = authenticateService.encodePassword(params.pass) 103 } 104 } 105 else { 106 person.pass = "NothingToClearValidation" 107 } 108 109 if (!person.hasErrors() && person.save()) { 110 Authority.findAll().each { it.removeFromPersons(person) } 111 addRoles(person) 112 redirect action: show, id: person.id 113 } 114 else { 115 render view: 'edit', model: buildPersonModel(person) 116 } 117 111 118 } 112 119 … … 122 129 def person = new Person() 123 130 person.properties = params 124 person.password = authenticateService.encodePassword(params.pass word)131 person.password = authenticateService.encodePassword(params.pass) 125 132 if (person.save()) { 126 133 addRoles(person)
Note: See TracChangeset
for help on using the changeset viewer.