Class: Spud::PasswordResetsController

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

Instance Method Summary collapse

Methods included from ApplicationHelper

#current_site_id, #current_site_name, #sortable

Instance Method Details

#createObject



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

def create
  @user = SpudUser.find_by_email(params[:email])
  if @user
    Spud::CoreMailer.forgot_password_notification(@user).deliver
    flash[:notice] = "Instructions to reset your password have been emailed to you. " +
    "Please check your email."
    redirect_to new_spud_user_session_url
  else
    flash[:notice] = "No user was found with that email address"
    render :action => :new
  end
end

#editObject



24
25
26
# File 'app/controllers/spud/password_resets_controller.rb', line 24

def edit
  render
end

#newObject



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

def new
  render
end

#updateObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/spud/password_resets_controller.rb', line 28

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