-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GrailsConfigurationAware to retrieve properties
- Loading branch information
Showing
1 changed file
with
12 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,8 @@ | |
*/ | ||
package grails.plugin.springsecurity.ui | ||
|
||
import grails.config.Config | ||
import grails.core.support.GrailsConfigurationAware | ||
import grails.plugin.springsecurity.authentication.dao.NullSaltSource | ||
import grails.plugin.springsecurity.ui.strategy.MailStrategy | ||
import grails.plugin.springsecurity.ui.strategy.PropertiesStrategy | ||
|
@@ -25,7 +27,7 @@ import org.springframework.security.authentication.dao.SaltSource | |
/** | ||
* @author <a href='mailto:[email protected]'>Burt Beckwith</a> | ||
*/ | ||
class RegisterController extends AbstractS2UiController { | ||
class RegisterController extends AbstractS2UiController implements GrailsConfigurationAware { | ||
|
||
static defaultAction = 'register' | ||
|
||
|
@@ -41,6 +43,13 @@ class RegisterController extends AbstractS2UiController { | |
/** Dependency injection for the 'uiPropertiesStrategy' bean. */ | ||
PropertiesStrategy uiPropertiesStrategy | ||
|
||
String serverURL | ||
|
||
@Override | ||
void setConfiguration(Config co) { | ||
serverURL = co.getProperty('grails.serverURL', String) | ||
} | ||
|
||
def register(RegisterCommand registerCommand) { | ||
|
||
if (!request.post) { | ||
|
@@ -188,8 +197,8 @@ class RegisterController extends AbstractS2UiController { | |
protected String generateLink(String action, Map linkParams, boolean shouldUseServerUrl = false) { | ||
String base = "$request.scheme://$request.serverName:$request.serverPort$request.contextPath" | ||
|
||
if (shouldUseServerUrl && Holders.config.grails.serverURL) { | ||
base = grailsApplication.config.grails.serverURL | ||
if (shouldUseServerUrl && serverURL) { | ||
base = serverURL | ||
} | ||
|
||
createLink( | ||
|