Sha256: 785a7a95421679f0b42cc3526509cf0ca61cda0821792082b3d50689a2040a58
Contents?: true
Size: 750 Bytes
Versions: 2
Compression:
Stored size: 750 Bytes
Contents
class PasswordsController < ApplicationController skip_before_action :authorization_required layout 'sessions' # From for user to update password def edit redirect_to(new_session_path) unless user.matches_verification_token?(token) # render passwords/edit.html.erb end # Update user's password 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 private def user @user ||= User.find(params[:user_id]) end def token @token ||= params[:token] end def password_params params.require(:user).permit(:password, :password_confirmation) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
minimalist_authentication-2.1.1 | app/controllers/passwords_controller.rb |
minimalist_authentication-2.1.0 | app/controllers/passwords_controller.rb |