Ignore:
Timestamp:
Nov 17, 2010, 4:20:33 PM (12 years ago)
Author:
robert@…
Message:

Improved the template editor so that template fields can be removed from templates, even if the templates are in use, but only if the template fields are never filled. (see ticket #74)

Also changed the user registration so that the administrator confirmation mails will be sent to the administrators in production environment, but still to gscfproject@… in other environments.

File:
1 edited

Legend:

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

    r1147 r1159  
    1515package dbnp.authentication
    1616import grails.plugins.springsecurity.Secured
     17import org.codehaus.groovy.grails.commons.GrailsApplication
     18import grails.util.GrailsUtil
    1719
    1820class UserRegistrationController {
     
    125127        def adminLink = createLink( controller: 'userRegistration', action: 'confirmAdmin', params: [code: adminCode.token], absolute: true )
    126128
     129                // If we are in production, send the mails to all administrators
     130                // Otherwise, send it to a default (spam) mail address
     131                def adminMail = "gscfproject@gmail.com";
     132                if ( GrailsUtil.getEnvironment().equals(GrailsApplication.ENV_PRODUCTION) ) {
     133                        def administrators = SecRole.findUsers( 'ROLE_ADMIN' );
     134                        if( administrators.size() > 0 ) {
     135                                adminMail = administrators.email.toArray();
     136                        }
     137                }
     138
    127139        // Send an email to the administrators
    128140        try {
    129141                        // Determine administrator email addresses
    130142            sendMail {
    131                 to      "gscfproject@gmail.com"
     143                to      adminMail
    132144                subject "New user (" + user.username + ") at GSCF"
    133145                html    g.render(template:"/email/registrationConfirmationAdmin", model:[username: user.username, email: user.email, link: adminLink])
Note: See TracChangeset for help on using the changeset viewer.