Class: PasswordResetsController

Inherits:
ApplicationController show all
Defined in:
lib/app/controllers/password_resets_controller.rb

Instance Attribute Summary

Attributes inherited from ActionController::Base

#formats

Instance Method Summary collapse

Methods included from InheritedResources::DSL

included

Methods inherited from ActionController::Base

clear_respond_to, inherit_resources, respond_to, #respond_to, #respond_with, #responder

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/app/controllers/password_resets_controller.rb', line 9

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 
  else
    flash[:notice] = "No user was found with that email address."
    render :action => :new
  end
end

#newObject



5
6
7
# File 'lib/app/controllers/password_resets_controller.rb', line 5

def new
  render
end

#showObject



21
22
23
# File 'lib/app/controllers/password_resets_controller.rb', line 21

def show
  render :action => :edit
end

#updateObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/app/controllers/password_resets_controller.rb', line 25

def update
  @user.password = params[:user][:password]
  @user.password_confirmation = params[:user][:password_confirmation]
  if @user.save
    flash[:notice] = "Password successfully updated"
    redirect_to 
  else
    render :action => :edit
  end
end