human? helper method on a user

This is cleaner than hard coding `id > 0` in ruby code.
This commit is contained in:
Robin Ward
2019-02-08 13:34:54 -05:00
parent fb18c57372
commit c719658f9f
5 changed files with 17 additions and 3 deletions

View File

@ -329,7 +329,7 @@ class SessionController < ApplicationController
RateLimiter.new(nil, "forgot-password-login-min-#{params[:login].to_s[0..100]}", 3, 1.minute).performed!
user = User.find_by_username_or_email(params[:login])
user_presence = user.present? && user.id > 0 && !user.staged
user_presence = user.present? && user.human? && !user.staged
if user_presence
email_token = user.email_tokens.create(email: user.email)
Jobs.enqueue(:critical_user_email, type: :forgot_password, user_id: user.id, email_token: email_token.token)