@@ -2,8 +2,17 @@ class Users::RegistrationsController < Devise::RegistrationsController |
||
2 | 2 |
|
3 | 3 |
# layout 'auth' |
4 | 4 |
|
5 |
+ def new |
|
6 |
+ # Check if open for signup |
|
7 |
+ @infos = Info.first |
|
8 |
+ if !@infos.open_for_signup |
|
9 |
+ redirect_to root_path, notice: (t 'registration.not_open_for_signup', name: @infos.website_name) |
|
10 |
+ return |
|
11 |
+ end |
|
12 |
+ super |
|
13 |
+ end |
|
14 |
+ |
|
5 | 15 |
def create |
6 |
- |
|
7 | 16 |
@user = User.where(email: params[:user][:email]).first |
8 | 17 |
if @user != nil |
9 | 18 |
if @user.invitation_accepted_at == nil && @user.invitation_sent_at != nil |
@@ -306,6 +306,7 @@ en: |
||
306 | 306 |
cancel_confirmation: Are you sure you want to delete your account permenantly? |
307 | 307 |
edit_password: Edit password |
308 | 308 |
email: Email |
309 |
+ not_open_for_signup: '%{name} is not open for signup right now.' |
|
309 | 310 |
subscription: |
310 | 311 |
subscribers: Subscribers |
311 | 312 |
header: Subscribe to our newsletter |
@@ -310,6 +310,7 @@ pt-BR: |
||
310 | 310 |
cancel_confirmation: Você tem certeza que deseja cancelar sua conta? |
311 | 311 |
edit_password: Editar senha |
312 | 312 |
email: Email |
313 |
+ not_open_for_signup: 'O %{name} não está aberto para novos registros neste momento.' |
|
313 | 314 |
subscription: |
314 | 315 |
subscribers: Assinantes |
315 | 316 |
header: Receba nossa newsletter |
@@ -98,7 +98,7 @@ Avalanche2::Application.routes.draw do |
||
98 | 98 |
get 'login' => 'devise/sessions#new', :as => :new_user_session |
99 | 99 |
post 'login' => 'devise/sessions#create', :as => :user_session |
100 | 100 |
delete 'logout' => 'devise/sessions#destroy', :as => :destroy_user_session |
101 |
- get 'signup' => 'devise/registrations#new', :as => :new_user_registration |
|
101 |
+ get 'signup' => 'users/registrations#new', :as => :new_user_registration |
|
102 | 102 |
post 'signup' => 'users/registrations#create', :as => :user_registration |
103 | 103 |
put 'signup' => 'users/registrations#update', :as => :user_registration_update |
104 | 104 |
|
@@ -0,0 +1,7 @@ |
||
1 |
+class AddSignupToInfos < ActiveRecord::Migration |
|
2 |
+ def change |
|
3 |
+ add_column :infos, :open_for_signup, :boolean |
|
4 |
+ add_column :infos, :open_for_invites, :boolean |
|
5 |
+ add_column :infos, :open_for_public, :boolean |
|
6 |
+ end |
|
7 |
+end |
@@ -11,7 +11,7 @@ |
||
11 | 11 |
# |
12 | 12 |
# It's strongly recommended that you check this file into your version control system. |
13 | 13 |
|
14 |
-ActiveRecord::Schema.define(version: 20150419000914) do |
|
14 |
+ActiveRecord::Schema.define(version: 20150419044718) do |
|
15 | 15 |
|
16 | 16 |
# These are extensions that must be enabled in order to support this database |
17 | 17 |
enable_extension "plpgsql" |
@@ -89,6 +89,9 @@ ActiveRecord::Schema.define(version: 20150419000914) do |
||
89 | 89 |
t.text "maintenance_message" |
90 | 90 |
t.string "website_link" |
91 | 91 |
t.string "server_email" |
92 |
+ t.boolean "open_for_signup" |
|
93 |
+ t.boolean "open_for_invites" |
|
94 |
+ t.boolean "open_for_public" |
|
92 | 95 |
end |
93 | 96 |
|
94 | 97 |
create_table "invites", force: true do |t| |