Class: FoundersToolkit::Auth::Securable::SessionsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Controller
Defined in:
lib/founders_toolkit/auth/securable/sessions_controller.rb

Direct Known Subclasses

SessionsController

Instance Method Summary collapse

Methods included from Controller

#sign_in

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/founders_toolkit/auth/securable/sessions_controller.rb', line 11

def create
  @user = User.find_by(email: params[:email])

  if @user&.authenticate(params[:password])
    session[:user_id] = @user.id
    redirect_to 
  else
    redirect_to new_session_path, alert: 'We could not sign you in with those credentials.'
  end
end

#destroyObject



22
23
24
25
# File 'lib/founders_toolkit/auth/securable/sessions_controller.rb', line 22

def destroy
  reset_session
  redirect_to after_logout_path
end

#newObject



9
# File 'lib/founders_toolkit/auth/securable/sessions_controller.rb', line 9

def new; end