Class: Dust::PasswordResetsController

Inherits:
AuthenticationController show all
Defined in:
app/controllers/dust/password_resets_controller.rb

Instance Method Summary collapse

Methods inherited from AuthenticationController

#not_authenticated, #permission_denied, #try_return_to_previous_page

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/dust/password_resets_controller.rb', line 11

def create
  @user = Dust::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"
    redirect_to root_path
  else
    flash.now[:error] = "No user was found with email address #{params[:email]}"
    render :action => :new
  end
end

#editObject



23
24
# File 'app/controllers/dust/password_resets_controller.rb', line 23

def edit
end

#newObject



8
9
# File 'app/controllers/dust/password_resets_controller.rb', line 8

def new
end

#updateObject



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

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