summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorazul <azul@leap.se>2014-07-11 13:00:27 +0200
committerazul <azul@leap.se>2014-07-11 13:00:27 +0200
commit1c7308207a9ab46cfb60c72aceaee2b3c82281fe (patch)
tree858f22fd9167b490b8b3fcaed2884215d0f0018a /app
parentc9dd5a342f902b27aec73af24776025a03feda48 (diff)
parent140155f32a9bd8ef2d5a581a1e56701a44a8f5a7 (diff)
Merge pull request #178 from fbernitt/issue_5217_allow_registration
Added allow_registration toggle.
Diffstat (limited to 'app')
-rw-r--r--app/controllers/users_controller.rb6
-rw-r--r--app/controllers/v1/users_controller.rb8
-rw-r--r--app/views/common/_action_buttons.html.haml9
3 files changed, 17 insertions, 6 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 5951413..a623653 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -26,7 +26,11 @@ class UsersController < UsersBaseController
end
def new
- @user = User.new
+ if APP_CONFIG[:allow_registration]
+ @user = User.new
+ else
+ redirect_to home_path
+ end
end
def show
diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb
index 006e6d8..881708a 100644
--- a/app/controllers/v1/users_controller.rb
+++ b/app/controllers/v1/users_controller.rb
@@ -19,8 +19,12 @@ module V1
end
def create
- @user = Account.create(params[:user])
- respond_with @user # return ID instead?
+ if APP_CONFIG[:allow_registration]
+ @user = Account.create(params[:user])
+ respond_with @user # return ID instead?
+ else
+ head :forbidden
+ end
end
def update
diff --git a/app/views/common/_action_buttons.html.haml b/app/views/common/_action_buttons.html.haml
index 266abe1..81ebf67 100644
--- a/app/views/common/_action_buttons.html.haml
+++ b/app/views/common/_action_buttons.html.haml
@@ -3,9 +3,12 @@
.login.span4
%span.link= btn icon('ok-sign') + t(:login), login_path
%span.info= t(:login_info, default: "")
- .signup.span4
- %span.link= btn icon('user') + t(:signup), signup_path
- %span.info= t(:signup_info, default: "")
+ - if APP_CONFIG[:allow_registration]
+ .signup.span4
+ %span.link= btn icon('user') + t(:signup), signup_path
+ %span.info= t(:signup_info, default: "")
+ - else
+ .signup.span4
.help.span4
%span.link= btn icon('question-sign') + t(:get_help), new_ticket_path
%span.info= t(:support_info, default: "")