Sha256: ba4e9d2146e275d727dd12649c99c22a8c44f6105f5b27f353fe2935b4a1c2dc
Contents?: true
Size: 1.32 KB
Versions: 10
Compression:
Stored size: 1.32 KB
Contents
class PasswordResetsController < ApplicationController before_filter :load_user_using_perishable_token, :only => [:show, :update] skip_before_filter :require_user respond_to :html def index end def create @user = SpudUser.find_by_email(params[:email]) if @user @user.reset_perishable_token! CoreMailer.forgot_password_notification(@user, password_reset_url(@user.perishable_token)).deliver flash[:notice] = "Password reset instructions have been sent to your email" redirect_to login_path else flash.now[:error] = "No user was found with that email address" render 'index' end end def show end def update if params[:spud_user][:password].blank? @user.errors.add(:password, 'must not be blank') else @user.password = params[:spud_user][:password] @user.password_confirmation = params[:spud_user][:password_confirmation] if @user.save() flash[:notice] = "Password successfully updated" redirect_back_or_default(root_path) return end end render 'show' end private def load_user_using_perishable_token @user = SpudUser.find_using_perishable_token(params[:id]) unless @user flash[:error] = "Password reset token was invalid or expired" redirect_to login_path end end end
Version data entries
10 entries across 10 versions & 1 rubygems