Module: Godmin::Authentication::SessionsController

Extended by:
ActiveSupport::Concern
Defined in:
lib/godmin/authentication/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/godmin/authentication/sessions_controller.rb', line 14

def create
  @admin_user = admin_user_class.()

  if @admin_user && @admin_user.authenticate(admin_user_params[:password])
    session[:admin_user_id] = @admin_user.id
    redirect_to root_path, notice: t("godmin.sessions.signed_in")
  else
    redirect_to new_session_path, alert: t("godmin.sessions.failed_sign_in")
  end
end

#destroyObject



25
26
27
28
# File 'lib/godmin/authentication/sessions_controller.rb', line 25

def destroy
  session[:admin_user_id] = nil
  redirect_to new_session_path, notice: t("godmin.sessions.signed_out")
end

#newObject



10
11
12
# File 'lib/godmin/authentication/sessions_controller.rb', line 10

def new
  @admin_user = admin_user_class.new
end