Module: RailsJwtAuth

Defined in:
lib/rails_jwt_auth.rb,
lib/rails_jwt_auth/engine.rb,
lib/rails_jwt_auth/version.rb,
lib/rails_jwt_auth/jwt_manager.rb,
lib/rails_jwt_auth/spec_helpers.rb,
app/models/concerns/rails_jwt_auth/invitable.rb,
app/models/concerns/rails_jwt_auth/trackable.rb,
app/models/concerns/rails_jwt_auth/confirmable.rb,
app/models/concerns/rails_jwt_auth/recoverable.rb,
app/controllers/rails_jwt_auth/sessions_controller.rb,
app/models/concerns/rails_jwt_auth/authenticatable.rb,
app/controllers/rails_jwt_auth/passwords_controller.rb,
app/controllers/concerns/rails_jwt_auth/params_helper.rb,
app/controllers/concerns/rails_jwt_auth/render_helper.rb,
app/controllers/rails_jwt_auth/invitations_controller.rb,
app/controllers/rails_jwt_auth/confirmations_controller.rb,
app/controllers/rails_jwt_auth/registrations_controller.rb,
app/controllers/concerns/rails_jwt_auth/authenticable_helper.rb

Defined Under Namespace

Modules: AuthenticableHelper, Authenticatable, Confirmable, Invitable, JwtManager, ParamsHelper, Recoverable, RenderHelper, SpecHelpers, Trackable Classes: ConfirmationsController, Engine, InstallGenerator, InvitationsController, Mailer, MigrateGenerator, PasswordsController, RegistrationsController, SessionsController

Constant Summary collapse

InvalidEmailField =
Class.new(StandardError)
InvalidAuthField =
Class.new(StandardError)
NotConfirmationsUrl =
Class.new(StandardError)
NotInvitationsUrl =
Class.new(StandardError)
NotResetPasswordsUrl =
Class.new(StandardError)
NotSetPasswordsUrl =
Class.new(StandardError)
VERSION =
'1.3.1'
NotAuthorized =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.auth_field_name!Object



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/rails_jwt_auth.rb', line 74

def self.auth_field_name!
  field_name = RailsJwtAuth.auth_field_name
  klass = RailsJwtAuth.model

  unless field_name.present? &&
         (klass.respond_to?(:column_names) && klass.column_names.include?(field_name) ||
          klass.respond_to?(:fields) && klass.fields[field_name])
    raise RailsJwtAuth::InvalidAuthField
  end

  field_name
end

.email_field_name!Object



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/rails_jwt_auth.rb', line 87

def self.email_field_name!
  field_name = RailsJwtAuth.email_field_name
  klass = RailsJwtAuth.model

  unless field_name.present? &&
         (klass.respond_to?(:column_names) && klass.column_names.include?(field_name) ||
          klass.respond_to?(:fields) && klass.fields[field_name])
    raise RailsJwtAuth::InvalidEmailField
  end

  field_name
end

.modelObject



62
63
64
# File 'lib/rails_jwt_auth.rb', line 62

def self.model
  model_name.constantize
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (RailsJwtAuth)

    the object that the method was called on



70
71
72
# File 'lib/rails_jwt_auth.rb', line 70

def self.setup
  yield self
end

.table_nameObject



66
67
68
# File 'lib/rails_jwt_auth.rb', line 66

def self.table_name
  model_name.underscore.pluralize
end