use system user helper and constant when it's referred
This commit is contained in:
parent
9937af7ac4
commit
ceca85c9eb
|
@ -120,7 +120,7 @@ class SessionController < ApplicationController
|
|||
RateLimiter.new(nil, "forgot-password-min-#{request.remote_ip}", 3, 1.minute).performed!
|
||||
|
||||
user = User.find_by_username_or_email(params[:login])
|
||||
user_presence = user.present? && user.id != -1
|
||||
user_presence = user.present? && user.id != Discourse::SYSTEM_USER_ID
|
||||
if user_presence
|
||||
email_token = user.email_tokens.create(email: user.email)
|
||||
Jobs.enqueue(:user_email, type: :forgot_password, user_id: user.id, email_token: email_token.token)
|
||||
|
|
|
@ -432,7 +432,7 @@ describe SessionController do
|
|||
end
|
||||
|
||||
context 'do nothing to system username' do
|
||||
let(:user) { User.find(-1) }
|
||||
let(:user) { Discourse.system_user }
|
||||
|
||||
it 'generates no token for system username' do
|
||||
lambda { xhr :post, :forgot_password, login: user.username}.should_not change(EmailToken, :count)
|
||||
|
|
Loading…
Reference in New Issue