Fix some errors with the public register functionality
parent
c7fddedd87
commit
38f617f943
|
@ -8,3 +8,4 @@ app/coffee/modules/locales/locale*.coffee
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
tags
|
tags
|
||||||
|
app/config/main.coffee
|
||||||
|
|
|
@ -45,7 +45,9 @@ class ConfigService extends taiga.Service
|
||||||
@.config = _.merge(defaults, localconfig)
|
@.config = _.merge(defaults, localconfig)
|
||||||
|
|
||||||
get: (key, defaultValue=null) ->
|
get: (key, defaultValue=null) ->
|
||||||
return @.config[key] || defaultValue
|
if _.has(@.config, key)
|
||||||
|
return @.config[key]
|
||||||
|
return defaultValue
|
||||||
|
|
||||||
|
|
||||||
# Initialize config loading local configuration.
|
# Initialize config loading local configuration.
|
||||||
|
|
|
@ -148,7 +148,7 @@ module.service("$tgAuth", AuthService)
|
||||||
# Directive that manages the visualization of public register
|
# Directive that manages the visualization of public register
|
||||||
# message/link on login page.
|
# message/link on login page.
|
||||||
|
|
||||||
PublicRegisterMessageDirective = ($config) ->
|
PublicRegisterMessageDirective = ($config, $navUrls) ->
|
||||||
template = _.template("""
|
template = _.template("""
|
||||||
<p class="login-text">
|
<p class="login-text">
|
||||||
<span>Not registered yet?</span>
|
<span>Not registered yet?</span>
|
||||||
|
@ -156,10 +156,11 @@ PublicRegisterMessageDirective = ($config) ->
|
||||||
</p>""")
|
</p>""")
|
||||||
|
|
||||||
templateFn = ->
|
templateFn = ->
|
||||||
url = $config.get("publicRegisterEnabled")
|
publicRegisterEnabled = $config.get("publicRegisterEnabled")
|
||||||
if not url
|
console.log publicRegisterEnabled
|
||||||
|
if not publicRegisterEnabled
|
||||||
return ""
|
return ""
|
||||||
return template({url:url})
|
return template({url:$navUrls.resolve("register")})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restrict: "AE"
|
restrict: "AE"
|
||||||
|
@ -167,12 +168,11 @@ PublicRegisterMessageDirective = ($config) ->
|
||||||
template: templateFn
|
template: templateFn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.directive("tgPublicRegisterMessage", ["$tgConfig", "$tgNavUrls", PublicRegisterMessageDirective])
|
||||||
|
|
||||||
module.directive("tgPublicRegisterMessage", ["$tgConfig", PublicRegisterMessageDirective])
|
|
||||||
|
|
||||||
LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls) ->
|
LoginDirective = ($auth, $confirm, $location, $routeParams, $navUrls) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$scope.pubblicRegisterEnabled = $config.get("pubblicRegisterEnabled")
|
|
||||||
$scope.data = {}
|
$scope.data = {}
|
||||||
|
|
||||||
onSuccessSubmit = (response) ->
|
onSuccessSubmit = (response) ->
|
||||||
|
@ -204,15 +204,19 @@ LoginDirective = ($auth, $confirm, $location, $config, $routeParams, $navUrls) -
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig", "$routeParams", "$tgNavUrls",
|
module.directive("tgLogin", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams", "$tgNavUrls",
|
||||||
LoginDirective])
|
LoginDirective])
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
## Register Directive
|
## Register Directive
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
RegisterDirective = ($auth, $confirm, $location, $config, $navUrls) ->
|
RegisterDirective = ($auth, $confirm, $location, $navUrls, $config) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
if not $config.get("publicRegisterEnabled")
|
||||||
|
$location.path("/not-found")
|
||||||
|
$location.replace()
|
||||||
|
|
||||||
$scope.data = {}
|
$scope.data = {}
|
||||||
form = $el.find("form").checksley()
|
form = $el.find("form").checksley()
|
||||||
|
|
||||||
|
@ -241,7 +245,7 @@ RegisterDirective = ($auth, $confirm, $location, $config, $navUrls) ->
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgConfig", "$tgNavUrls",
|
module.directive("tgRegister", ["$tgAuth", "$tgConfirm", "$tgLocation", "$tgNavUrls", "$tgConfig",
|
||||||
RegisterDirective])
|
RegisterDirective])
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -333,7 +337,7 @@ module.directive("tgChangePasswordFromRecovery", ["$tgAuth", "$tgConfirm", "$tgL
|
||||||
## Invitation
|
## Invitation
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
InvitationDirective = ($auth, $confirm, $location, $params, $config, $navUrls) ->
|
InvitationDirective = ($auth, $confirm, $location, $params, $navUrls) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
token = $params.token
|
token = $params.token
|
||||||
|
|
||||||
|
@ -404,7 +408,7 @@ InvitationDirective = ($auth, $confirm, $location, $params, $config, $navUrls) -
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams", "$tgConfig",
|
module.directive("tgInvitation", ["$tgAuth", "$tgConfirm", "$tgLocation", "$routeParams",
|
||||||
"$tgNavUrls", InvitationDirective])
|
"$tgNavUrls", InvitationDirective])
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
Loading…
Reference in New Issue