Sha256: f3a6336c4d34b60906f44ca4bafa3f12e225dc75698ca0c1b0f5bdf9273696be

Contents?: true

Size: 1.36 KB

Versions: 10

Compression:

Stored size: 1.36 KB

Contents

# Manages logging in and out of the application.
class SessionController < ApplicationController
  include Authpwn::SessionController
  
  # Sets up the 'session/welcome' view. No user is logged in.
  def welcome
    # You can brag about some statistics.
    @user_count = User.count
  end
  private :welcome

  # Sets up the 'session/home' view. A user is logged in.
  def home
    # Pull information about the current user.
    @user = current_user
  end
  private :home
  
  # The notification text displayed when a session authentication fails.
  def bounce_notice_text(reason)
    case reason
    when :invalid
      'Invalid e-mail or password'
    when :blocked
      'Account blocked. Please verify your e-mail address'
    end
  end
  
  # A user is logged in, based on a token.
  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
  private :home_with_token
  
  # You shouldn't extend the session controller, so you can benefit from future
  # features. But, if you must, you can do it here.
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
authpwn_rails-0.12.0 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.11.1 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.11.0 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.12 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.11 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.10 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.9 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.8 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.7 lib/authpwn_rails/generators/templates/session_controller.rb
authpwn_rails-0.10.6 lib/authpwn_rails/generators/templates/session_controller.rb