app/controllers/trestle/auth/sessions_controller.rb in trestle-auth-0.3.0 vs app/controllers/trestle/auth/sessions_controller.rb in trestle-auth-0.4.0
- old
+ new
@@ -1,17 +1,16 @@
class Trestle::Auth::SessionsController < Trestle::ApplicationController
layout 'trestle/auth'
+ skip_before_action :authenticate_user, only: [:new, :create]
skip_before_action :require_authenticated_user
def new
end
def create
- if user = Trestle.config.auth.authenticate(params)
- login!(user)
- remember_me! if params[:remember_me] == "1"
- redirect_to previous_location || instance_exec(&Trestle.config.auth.redirect_on_login)
+ if authentication_backend.authenticate!
+ redirect_to authentication_backend.previous_location || instance_exec(&Trestle.config.auth.redirect_on_login)
else
flash[:error] = t("admin.auth.error", default: "Incorrect login details.")
redirect_to action: :new
end
end