Sha256: e088b1a1cf909c718d6d695c47589a50d40a55207e27d56001d7e312c9a24ff0
Contents?: true
Size: 697 Bytes
Versions: 2
Compression:
Stored size: 697 Bytes
Contents
module DeviseTokenAuth::Concerns::UserOmniauthCallbacks extend ActiveSupport::Concern included do validates :email, presence: true,if: :email_provider? validates :email, email: true, allow_nil: true, allow_blank: true, if: :email_provider? validates_presence_of :uid, unless: :email_provider? # only validate unique emails among email registration users validates :email, uniqueness: { scope: :provider }, on: :create, if: :email_provider? # keep uid in sync with email before_save :sync_uid before_create :sync_uid end protected def email_provider? provider == 'email' end def sync_uid self.uid = email if provider == 'email' end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
devise_token_auth-0.1.43 | app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb |
digix_devise_token_auth-0.1.44 | app/models/devise_token_auth/concerns/user_omniauth_callbacks.rb |