Class: PasswordsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/passwords_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject

From for user to update password



7
8
9
10
# File 'app/controllers/passwords_controller.rb', line 7

def edit
  redirect_to(new_session_path) unless user.matches_verification_token?(token)
  # render passwords/edit.html.erb
end

#updateObject

Update user’s password



13
14
15
16
17
18
19
# File 'app/controllers/passwords_controller.rb', line 13

def update
  if user.secure_update(token, password_params.merge(password_required: true))
    redirect_to new_session_path, notice: 'Password successfully updated'
  else
    render :edit
  end
end