Sha256: ffe6e3b5f51016bc4771cd8a7c60c53504202ba32588aff60640bd225216961d

Contents?: true

Size: 595 Bytes

Versions: 7

Compression:

Stored size: 595 Bytes

Contents

class SessionsController < ApplicationController
  allow_unauthenticated_access only: %i[ new create ]
  rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." }

  def new
  end

  def create
    if user = User.authenticate_by(params.permit(:email_address, :password))
      start_new_session_for user
      redirect_to after_authentication_url
    else
      redirect_to new_session_url, alert: "Try another email address or password."
    end
  end

  def destroy
    terminate_session
    redirect_to new_session_url
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
railties-8.0.0.rc1 lib/rails/generators/rails/authentication/templates/app/controllers/sessions_controller.rb.tt
railties-8.0.0.beta1 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
omg-railties-8.0.0.alpha9 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
omg-railties-8.0.0.alpha8 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
omg-railties-8.0.0.alpha7 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
omg-railties-8.0.0.alpha4 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb
omg-railties-8.0.0.alpha3 lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb