class SessionController

Manages logging in and out of the application.

Public Instance Methods

bounce_notice_text(reason) click to toggle source

The notification text displayed when a session authentication fails.

# File lib/authpwn_rails/generators/templates/session_controller.rb, line 20
def bounce_notice_text(reason)
  case reason
  when :invalid
    'Invalid e-mail or password'
  when :expired
    'Password expired. Please click "Forget password"'
  when :blocked
    'Account blocked. Please verify your e-mail address'
  end
end

Private Instance Methods

home() click to toggle source

Sets up the 'session/home' view. A user is logged in.

# File lib/authpwn_rails/generators/templates/session_controller.rb, line 13
def home
  # Pull information about the current user.
  @user = current_user
end
home_with_token(token) click to toggle source

A user is logged in, based on a token.

# File lib/authpwn_rails/generators/templates/session_controller.rb, line 32
def home_with_token(token)
  respond_to do |format|
    format.html do
      case token
      when Tokens::EmailVerification
        redirect_to session_url, notice: 'E-mail address confirmed'
      when Tokens::PasswordReset
        redirect_to change_password_session_url
      # Handle other token types here.
      end
    end
    format.json do
      # Rely on default behavior.
    end
  end
end
welcome() click to toggle source

Sets up the 'session/welcome' view. No user is logged in.

# File lib/authpwn_rails/generators/templates/session_controller.rb, line 6
def welcome
  # You can brag about some statistics.
  @user_count = User.count
end