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



9
10
11
12
# File 'app/controllers/passwords_controller.rb', line 9

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

#updateObject

Update user’s password



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

def update
  if user.secure_update(token, password_params.merge(password_required: true))
    redirect_to new_session_path, notice: t(".notice")
  else
    render :edit
  end
end