Class: Alchemy::UserSessionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/alchemy/user_sessions_controller.rb', line 21

def create
  authenticate_user!

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

#destroyObject



38
39
40
41
42
43
# File 'app/controllers/alchemy/user_sessions_controller.rb', line 38

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

#newObject



17
18
19
# File 'app/controllers/alchemy/user_sessions_controller.rb', line 17

def new
  super
end