Ignore:
Timestamp:
May 6, 2009, 3:40:07 AM (15 years ago)
Author:
gav
Message:

Logins now route through a welcome action to allow flash message and user environment setup. Session timeout now user configurable and defaults to 12 hours. Work on Planned Maintenance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/AppCoreController.groovy

    r106 r127  
    1010    //def allowedMethods = [delete:'POST', save:'POST', update:'POST']
    1111
     12    def welcome = {
     13        def personInstance = Person.get(authenticateService.userDomain().id)
     14        flash.message = "Welcome, ${personInstance.firstName} ${personInstance.lastName}."
     15
     16        def sess = getSession()
     17        sess.setMaxInactiveInterval(personInstance.sessionTimeout)
     18        redirect(action:home)
     19    }
     20
    1221    def home = {
    1322    }
     
    1524    def options = {
    1625    }
     26
     27    def changeSessionTimeout = {
     28        if (request.method == 'GET') {
     29            def personInstance = Person.get(authenticateService.userDomain().id)
     30            return [ personInstance : personInstance ]       
     31        }
     32        if (request.method == 'POST') {
     33            def personInstance = Person.get(authenticateService.userDomain().id)
     34//             personInstance.sessionTimeout = params.sessionTimeout.toInteger()
     35                personInstance.properties = params
     36                if (!personInstance.hasErrors() && personInstance.save()) {
     37                    def sess = getSession()
     38                    sess.setMaxInactiveInterval(personInstance.sessionTimeout)
     39                    flash.message = "Session timeout changed."
     40                    redirect(action:options)
     41                }
     42                else {
     43                    render(view:'changeSessionTimeout',model:[personInstance:personInstance])
     44                }
     45        }
     46    }         
    1747
    1848    def changePassword = {
Note: See TracChangeset for help on using the changeset viewer.