Module: RailsJwtAuth

Defined in:
lib/rails_jwt_auth.rb,
lib/rails_jwt_auth/engine.rb,
lib/rails_jwt_auth/session.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/lockable.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/profiles_controller.rb,
app/controllers/rails_jwt_auth/sessions_controller.rb,
app/models/concerns/rails_jwt_auth/authenticatable.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/rails_jwt_auth/reset_passwords_controller.rb,
app/controllers/rails_jwt_auth/unlock_accounts_controller.rb,
app/controllers/concerns/rails_jwt_auth/authenticable_helper.rb

Defined Under Namespace

Modules: AuthenticableHelper, Authenticatable, Confirmable, Invitable, JwtManager, Lockable, ParamsHelper, Recoverable, RenderHelper, SpecHelpers, Trackable Classes: ConfirmationsController, Engine, InstallGenerator, InvitationsController, Mailer, MigrateGenerator, ProfilesController, RegistrationsController, ResetPasswordsController, Session, SessionsController, UnlockAccountsController

Constant Summary collapse

NotConfirmationsUrl =
Class.new(StandardError)
NotInvitationsUrl =
Class.new(StandardError)
NotResetPasswordsUrl =
Class.new(StandardError)
NotUnlockUrl =
Class.new(StandardError)
InvalidJwtPayload =
Class.new(StandardError)
VERSION =
'2.0.4'
NotAuthorized =
Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.friendly_token(length = 24) ⇒ Object



110
111
112
113
114
115
# File 'lib/rails_jwt_auth.rb', line 110

def self.friendly_token(length = 24)
  # To calculate real characters, we must perform this operation.
  # See SecureRandom.urlsafe_base64
  rlength = (length * 3 / 4) - 1
  SecureRandom.urlsafe_base64(rlength, true).tr('lIO0', 'sxyz')
end

.mailerObject



101
102
103
# File 'lib/rails_jwt_auth.rb', line 101

def self.mailer
  mailer_name.constantize
end

.modelObject



97
98
99
# File 'lib/rails_jwt_auth.rb', line 97

def self.model
  model_name.constantize
end

.send_email(method, user) ⇒ Object



117
118
119
120
# File 'lib/rails_jwt_auth.rb', line 117

def self.send_email(method, user)
  mailer = RailsJwtAuth.mailer.with(user_id: user.id.to_s).public_send(method)
  RailsJwtAuth.deliver_later ? mailer.deliver_later : mailer.deliver
end

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

Yields:

  • (_self)

Yield Parameters:

  • _self (RailsJwtAuth)

    the object that the method was called on



93
94
95
# File 'lib/rails_jwt_auth.rb', line 93

def self.setup
  yield self
end

.table_nameObject



105
106
107
# File 'lib/rails_jwt_auth.rb', line 105

def self.table_name
  model_name.underscore.pluralize
end