Class: SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
# File 'lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb', line 8

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

#destroyObject



17
18
19
20
# File 'lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb', line 17

def destroy
  terminate_session
  redirect_to new_session_url
end

#newObject



5
6
# File 'lib/rails/generators/rails/authentication/templates/controllers/sessions_controller.rb', line 5

def new
end