Class: Protected::SessionsController

Inherits:
Devise::SessionsController
  • Object
show all
Defined in:
app/controllers/protected/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#first_loginObject



8
9
10
# File 'app/controllers/protected/sessions_controller.rb', line 8

def 
  redirect_to root_url unless current_user
end

#update_first_loginObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/protected/sessions_controller.rb', line 12

def 
  current_user.update_on_first_login!(params[:user])
  if current_user.errors.any?
    render :action => :first_login
  else
    sign_out_all_scopes
    flash[:notice] = "Your password has been changed, please log in again."
    redirect_to new_user_session_url
  end
rescue PasswordAlreadyUsedException => e
  current_user.errors.add(:password, e.message)
  render :action => :first_login
rescue ActiveRecord::RecordInvalid => f
  render :action => :first_login
end