mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
Admins who haven't been approved can log in when must_approve_users is enabled
This commit is contained in:
parent
57baf1f112
commit
c74da0d262
2 changed files with 12 additions and 1 deletions
|
@ -22,7 +22,7 @@ class SessionController < ApplicationController
|
|||
if @user.present?
|
||||
|
||||
# If the site requires user approval and the user is not approved yet
|
||||
if SiteSetting.must_approve_users? && !@user.approved?
|
||||
if SiteSetting.must_approve_users? && !@user.approved? && !@user.admin?
|
||||
render json: {error: I18n.t("login.not_approved")}
|
||||
return
|
||||
end
|
||||
|
|
|
@ -107,6 +107,17 @@ describe SessionController do
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
context "with an unapproved user who is an admin" do
|
||||
before do
|
||||
User.any_instance.stubs(:admin?).returns(true)
|
||||
xhr :post, :create, login: user.email, password: 'myawesomepassword'
|
||||
end
|
||||
|
||||
it 'sets a session id' do
|
||||
session[:current_user_id].should == user.id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue