-
Notifications
You must be signed in to change notification settings - Fork 111
Open
Description
I have FormUser Model which belongs to User model, and in my FormUser model is to tak care of omniauth schemes login with email password logins. When I try to use the switch back feature, the following error apepars.
SwitchUser::InvalidScope in SwitchUserController#remember_user
form_user is invalid and is not listed in SwitchUser#available_users
My form user model is as below.
class FormUser < User
attr_accessor :current_password
validates_presence_of :email, if: :email_required?
validates_uniqueness_of :email, allow_blank: true, if: :email_changed?
validates_format_of :email, with: Devise.email_regexp, allow_blank: true, if: :email_changed?
validates_presence_of :password, if: :password_required?
validates_confirmation_of :password, if: :password_required?
validates_length_of :password, within: Devise.password_length, allow_blank: true
def password_required?
return false if email.blank?
!persisted? || !password.nil? || !password_confirmation.nil?
end
def email_required?
true
end
endMetadata
Metadata
Assignees
Labels
No labels