|
|
@ -334,20 +334,26 @@ describe AccountController do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with manual activation" do |
|
|
|
context "with manual activation" do |
|
|
|
before do |
|
|
|
let(:user_hash) do |
|
|
|
allow(Setting).to receive(:self_registration).and_return("2") |
|
|
|
{ :login => 'register', |
|
|
|
post :register, :user => { |
|
|
|
|
|
|
|
:login => 'register', |
|
|
|
|
|
|
|
:password => 'adminADMIN!', |
|
|
|
:password => 'adminADMIN!', |
|
|
|
:password_confirmation => 'adminADMIN!', |
|
|
|
:password_confirmation => 'adminADMIN!', |
|
|
|
:firstname => 'John', |
|
|
|
:firstname => 'John', |
|
|
|
:lastname => 'Doe', |
|
|
|
:lastname => 'Doe', |
|
|
|
:mail => 'register@example.com' |
|
|
|
:mail => 'register@example.com' } |
|
|
|
} |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
allow(Setting).to receive(:self_registration).and_return("2") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "without back_url" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
post :register, :user => user_hash |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the login page" do |
|
|
|
it "redirects to the login page" do |
|
|
|
should redirect_to '/login' |
|
|
|
expect(response).to redirect_to '/login' |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "doesn't activate the user" do |
|
|
|
it "doesn't activate the user" do |
|
|
@ -355,6 +361,18 @@ describe AccountController do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with back_url" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
post :register, :user => user_hash, :back_url => 'https://example.net/some_back_url' |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'preserves the back url' do |
|
|
|
|
|
|
|
expect(response).to redirect_to( |
|
|
|
|
|
|
|
'/login?back_url=https%3A%2F%2Fexample.net%2Fsome_back_url') |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with self registration off" do |
|
|
|
context "with self registration off" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
allow(Setting).to receive(:self_registration).and_return("0") |
|
|
|
allow(Setting).to receive(:self_registration).and_return("0") |
|
|
|