Class: Alchemy::Admin::UserSessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Includes:
Locale
Defined in:
app/controllers/alchemy/admin/user_sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/alchemy/admin/user_sessions_controller.rb', line 18

def create
  authenticate_user!

  if user_signed_in?
    redirect_path = if session[:redirect_path].blank?
      admin_dashboard_path
    else
      # We have to strip double slashes from beginning of path, because of strange rails/rack bug.
      session[:redirect_path].gsub(/\A\/{2,}/, "/")
    end
    redirect_to redirect_path,
      notice: t(:signed_in, scope: "devise.sessions")
  else
    super
  end
end

#destroyObject



35
36
37
38
39
40
# File 'app/controllers/alchemy/admin/user_sessions_controller.rb', line 35

def destroy
  current_alchemy_user.try(:unlock_pages!)
  cookies.clear
  session.clear
  super
end