Skip to content
Snippets Groups Projects
Commit 50e8e594 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'redirect-sign_up' into 'master'

Redirect signup page to signin page.

Resolves #1916.

See merge request !1468
parents 31323205 ab22caa9
No related branches found
No related tags found
No related merge requests found
class RegistrationsController < Devise::RegistrationsController class RegistrationsController < Devise::RegistrationsController
before_filter :signup_enabled? before_filter :signup_enabled?
   
def new
redirect_to(new_user_session_path)
end
def destroy def destroy
current_user.destroy current_user.destroy
   
Loading
Loading
require 'spec_helper' require 'spec_helper'
   
describe 'Users', feature: true do describe 'Users', feature: true do
describe "GET /users/sign_up" do describe "GET /users/sign_in" do
before do
ApplicationSetting.any_instance.stub(signup_enabled?: true)
end
it "should create a new user account" do it "should create a new user account" do
visit new_user_registration_path visit new_user_session_path
fill_in "user_name", with: "Name Surname" fill_in "user_name", with: "Name Surname"
fill_in "user_username", with: "Great" fill_in "user_username", with: "Great"
fill_in "user_email", with: "name@mail.com" fill_in "user_email", with: "name@mail.com"
fill_in "user_password", with: "password1234" fill_in "user_password_sign_up", with: "password1234"
fill_in "user_password_confirmation", with: "password1234" expect { click_button "Sign up" }.to change { User.count }.by(1)
expect { click_button "Sign up" }.to change {User.count}.by(1)
end end
end end
end end
Loading
@@ -184,27 +184,11 @@ describe API::API, api: true do
Loading
@@ -184,27 +184,11 @@ describe API::API, api: true do
end end
   
describe "GET /users/sign_up" do describe "GET /users/sign_up" do
context 'enabled' do
before do
ApplicationSetting.any_instance.stub(signup_enabled?: true)
end
it "should return sign up page if signup is enabled" do
get "/users/sign_up"
response.status.should == 200
end
end
   
context 'disabled' do it "should redirect to sign in page" do
before do get "/users/sign_up"
ApplicationSetting.any_instance.stub(signup_enabled?: false) response.status.should == 302
end response.should redirect_to(new_user_session_path)
it "should redirect to sign in page if signup is disabled" do
get "/users/sign_up"
response.status.should == 302
response.should redirect_to(new_user_session_path)
end
end end
end end
   
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment