Sha256: d8a25493c31dfc0159836b06229b21d06568656c1a304c024fda387c39986df7
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
class PasswordResetsController < ApplicationController before_filter :require_no_user before_filter :load_user_using_perishable_token, :only => [:show, :edit, :update] def new render end def create @user = User.find_by_email(params[:email]) if @user @user.deliver_password_reset_instructions! flash[:notice] = "Instructions to reset your password have been emailed to you. Please check your email." redirect_to login_url else flash[:notice] = "No user was found with that email address." render :action => :new end end def show render :action => :edit end def update @user.password = params[:user][:password] @user.password_confirmation = params[:user][:password_confirmation] if @user.save flash[:notice] = "Password successfully updated" redirect_to my_account_url else render :action => :edit end end private def load_user_using_perishable_token @user = User.find_using_perishable_token(params[:id]) unless @user flash[:notice] = "Sorry, but we could not locate your account. If you are having issues try copying and pasting the URL from your email into your browser or restarting the reset password process." redirect_to login_url end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
base_rails_app-0.0.1 | lib/app/controllers/password_resets_controller.rb |