class RailsJwtAuthOmniauth::OmniauthSession
Attributes
errors[R]
jwt[R]
user[R]
Public Class Methods
new(user)
click to toggle source
# File lib/rails_jwt_auth_omniauth/omniauth_session.rb, line 8 def initialize(user) @user = user end
Public Instance Methods
generate!()
click to toggle source
# File lib/rails_jwt_auth_omniauth/omniauth_session.rb, line 18 def generate! if valid? @user.clean_reset_password if recoverable? @user.clean_lock if lockable? @user.load_auth_token unless user.save add_error(RailsJwtAuth.model_name.underscore, :invalid) return false end generate_jwt(nil) true else @user.failed_attempt if lockable? false end end
valid?()
click to toggle source
# File lib/rails_jwt_auth_omniauth/omniauth_session.rb, line 12 def valid? validate! !errors? end
Private Instance Methods
validate!()
click to toggle source
# File lib/rails_jwt_auth_omniauth/omniauth_session.rb, line 42 def validate! # Can't use ActiveModel::Validations since we have dynamic fields @errors = Errors.new({}) validate_user validate_user_is_confirmed if confirmable? validate_user_is_not_locked if lockable? validate_custom end
validate_user()
click to toggle source
# File lib/rails_jwt_auth_omniauth/omniauth_session.rb, line 52 def validate_user add_error(:session, :not_found) if @user.blank? end