Navigation Menu

Skip to content

Commit

Permalink
Disable new user registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
gkop committed May 26, 2020
1 parent 3d499fe commit 79177cb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Gemfile.lock
Expand Up @@ -374,3 +374,9 @@ DEPENDENCIES
unicorn
webmock
zurb-foundation (= 3.0.9)

RUBY VERSION
ruby 2.2.0p0

BUNDLED WITH
1.16.6
19 changes: 18 additions & 1 deletion config/routes.rb
Expand Up @@ -9,7 +9,24 @@
resources :schools
resources :job_posts

devise_for :users, controllers: {sessions: "devise_overrides/sessions"}
disable_new_user_registrations = Rails.env.production?

if disable_new_user_registrations
devise_for :users,
controllers: {sessions: "devise_overrides/sessions"},
skip: [:registrations]

# https://stackoverflow.com/a/31779657/283398
resource :users,
only: [:edit, :update, :destroy],
controller: 'devise/registrations',
as: :user_registration do
get 'cancel'
get 'new' => redirect("/"), as: :new
end
else
devise_for :users, controllers: {sessions: "devise_overrides/sessions"}
end

#resources :venues
# NOTE I just discovered that any user could destroy venues, so have
Expand Down

0 comments on commit 79177cb

Please sign in to comment.