Module: Obscured::Doorman

Extended by:
Loggable
Defined in:
lib/obscured-doorman.rb,
lib/obscured-doorman/base.rb,
lib/obscured-doorman/errors.rb,
lib/obscured-doorman/mailer.rb,
lib/obscured-doorman/helpers.rb,
lib/obscured-doorman/version.rb,
lib/obscured-doorman/loggable.rb,
lib/obscured-doorman/messages.rb,
lib/obscured-doorman/models/user.rb,
lib/obscured-doorman/models/token.rb,
lib/obscured-doorman/configuration.rb,
lib/obscured-doorman/utilities/roles.rb,
lib/obscured-doorman/utilities/types.rb,
lib/obscured-doorman/providers/github.rb,
lib/obscured-doorman/providers/bitbucket.rb,
lib/obscured-doorman/strategies/password.rb,
lib/obscured-doorman/strategies/remember_me.rb,
lib/obscured-doorman/providers/github/messages.rb,
lib/obscured-doorman/providers/github/strategy.rb,
lib/obscured-doorman/strategies/forgot_password.rb,
lib/obscured-doorman/providers/base/configuration.rb,
lib/obscured-doorman/providers/bitbucket/messages.rb,
lib/obscured-doorman/providers/bitbucket/strategy.rb,
lib/obscured-doorman/providers/github/access_token.rb,
lib/obscured-doorman/providers/github/configuration.rb,
lib/obscured-doorman/providers/bitbucket/access_token.rb,
lib/obscured-doorman/providers/bitbucket/configuration.rb

Defined Under Namespace

Modules: Base, Helpers, Loggable, Providers, Roles, Strategies, Types Classes: Configuration, Error, Mailer, Middleware, Token, User

Constant Summary collapse

VERSION =
"0.4.1".freeze
MESSAGES =
{
  auth_required: 'You must be logged in to view this page.',
  signup_disabled: 'Registration is disabled, contact team member for creation of account!',
  signup_success: 'You have signed up successfully. A confirmation email has been sent to you.',
  confirm_no_user: 'Invalid confirmation URL. Please make sure you have the correct link from the email, and are not already confirmed.',
  confirm_success: 'You have successfully confirmed your account. Please log in.',
  # Auto login upon confirmation?
  login_bad_credentials: 'Invalid Login and Password. Please try again.',
  login_not_confirmed: 'You must confirm your account before you can log in. Please click the confirmation link sent to you.',
  # Note: resend confirmation link?
  logout_success: 'You have been logged out.',
  forgot_no_user: 'There is no user with that Username or Email. Please try again.',
  forgot_success: 'An email with instructions to reset your password has been sent to you.',
  reset_no_user: 'Invalid reset URL. Please make sure you have the correct link from the email, and have already reset the password.',
  reset_system_user: 'Your trying to reset the password of a system user, unfortunate for you, this action is not allowed',
  reset_unmatched_passwords: 'Password and confirmation do not match. Please try again.',
  reset_success: 'Your password has been reset.',
  # Registration
  register_account_exists: 'Account already registered.',
  # Token
  token_used: 'The token has already been used, request a new token and try again.',
  token_expired: 'The token has expired, request a new token and try again.',
  token_not_found: 'The token was not found, request a new token and try again.'
}.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Loggable

logger, logger=

Class Attribute Details

.configurationObject



60
61
62
# File 'lib/obscured-doorman.rb', line 60

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.default_configurationObject



64
65
66
# File 'lib/obscured-doorman.rb', line 64

def default_configuration
  configuration.defaults
end

.setup {|configuration| ... } ⇒ Object

Configuration options should be set by passing a hash:

Obscured::Doorman.setup do |cfg|
  cfg.confirmation   = false,
  cfg.registration   = true,
  cfg.smtp_domain    = 'domain.tld',
  cfg.smtp_username  = 'username',
  cfg.smtp_password  = 'password',
end

Yields:



53
54
55
56
57
58
# File 'lib/obscured-doorman.rb', line 53

def setup
  yield(configuration)

  require 'obscured-doorman/models/user'
  require 'obscured-doorman/models/token'
end