mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05:00
FIX: Ensure that login does not fail for users with invite records (#15647)
In the unlikely, but possible, scenario where a user has no email_tokens, and has an invite record for their email address, login would fail. This commit fixes the `Invite` `user_doesnt_already_exist` validation so that it only applies to new invites, or when changing the email address.
This regressed in d8fe0f4199 (based on `git bisect`)
This commit is contained in:
@@ -32,7 +32,7 @@ class Invite < ActiveRecord::Base
|
||||
validates :email, email: true, allow_blank: true
|
||||
validate :ensure_max_redemptions_allowed
|
||||
validate :valid_domain, if: :will_save_change_to_domain?
|
||||
validate :user_doesnt_already_exist
|
||||
validate :user_doesnt_already_exist, if: :will_save_change_to_email?
|
||||
|
||||
before_create do
|
||||
self.invite_key ||= SecureRandom.base58(10)
|
||||
|
||||
Reference in New Issue
Block a user