Skip to content

Commit

Permalink
Use GrailsConfigurationAware to retrieve properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelamo committed Oct 26, 2017
1 parent e2f6689 commit 1c55d91
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'

Expand All @@ -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) {
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1c55d91

Please sign in to comment.