Class: PasswordsController

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

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Instance Method Summary collapse

Methods inherited from ApplicationController

#auto_complete

Instance Method Details

#createObject




29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/passwords_controller.rb', line 29

def create
  @user = User.find_by_email(params[:email])
  if @user
    @user.deliver_password_reset_instructions!
    flash[:notice] = t(:msg_pwd_instructions_sent)
    redirect_to root_url
  else
    flash[:notice] = t(:msg_email_not_found)
    redirect_to :action => :new
  end
end

#editObject




42
43
44
# File 'app/controllers/passwords_controller.rb', line 42

def edit
  # <-- render edit.html.haml
end

#newObject




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

def new
  # <-- render new.html.haml
end

#updateObject




47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/passwords_controller.rb', line 47

def update
  if empty_password?
    flash[:notice] = t(:msg_enter_new_password)
    render :edit
  elsif @user.update_attributes(params[:user])
    flash[:notice] = t(:msg_password_updated)
    redirect_to profile_url
  else
    render :edit
  end
end