Class AccountController
In: app/controllers/account_controller.rb
Parent: ApplicationController

Methods

activate   confirm_delete   destroy   edit   pwd_edit   pwd_update   show   update  

Public Instance methods

[Source]

    # File app/controllers/account_controller.rb, line 84
84:   def activate
85:     @title = "Activar cuenta"
86:     if @user = Person.find(:first, :conditions => ["id= ? AND crypted_password = ? AND status IN ('pendiente', 'aprobado')", params[:u], params[:p]])
87:       @user.update_attribute(:status, "aprobado")
88:       self.current_user = @user
89:       @success = true
90:     else
91:       success = false
92:     end
93:   end

[Source]

    # File app/controllers/account_controller.rb, line 60
60:   def confirm_delete
61:     @title = t('account.confirm_delete_account_title')
62:     render :action => "confirm_delete", :layout => @layout
63:   end

[Source]

    # File app/controllers/account_controller.rb, line 65
65:   def destroy
66:     if params[:cancel]
67:       flash[:notice] = t('account.cuenta_no_eliminada')
68:       redirect_to account_path
69:     else
70:       @user = User.find(current_user.id)
71:       if @user.destroy
72:         self.current_user.forget_me if logged_in?
73:         cookies.delete :auth_token
74:         reset_session
75:         flash[:notice] = t('account.cuenta_eliminada')
76:         redirect_to root_path
77:       else
78:         flash[:error] = t('account.cuenta_no_eliminada_razon')
79:         redirect_to account_path
80:       end
81:     end
82:   end

[Source]

    # File app/controllers/account_controller.rb, line 17
17:   def edit
18:     @user = current_user    
19:     @title = t('account.modificar_mis_datos')
20:     @breadcrumbs_info = [[t('account.mi_cuenta'), account_path], [t('account.modificar_mis_datos'), edit_account_path]]
21:     render :action => "edit", :layout => @layout
22:   end

[Source]

    # File app/controllers/account_controller.rb, line 34
34:   def pwd_edit
35:     @user = User.find(current_user.id)
36:     @title = t('account.cambiando_contrasena')
37:     @breadcrumbs_info = [[t('account.mi_cuenta'), account_path], [t('account.cambiando_contrasena'), pwd_edit_account_path]]
38:     render :action => "pwd_edit", :layout => @layout
39:   end

[Source]

    # File app/controllers/account_controller.rb, line 41
41:   def pwd_update
42:     @user = User.find(current_user.id)
43:     if params[:old_password] != @user.plain_password
44:       flash[:error] = t('account.contrasena_erronea')
45:       redirect_to :action => "pwd_edit", :layout => @layout
46:     else
47:       if params[:user][:password].empty?
48:         @user.errors.add(:password, ActiveRecord::Errors.default_error_messages[:empty])
49:         render :action => "pwd_edit", :layout => @layout and return
50:       end
51:       if @user.update_attributes(:password => params[:user][:password], :password_confirmation => params[:user][:password_confirmation])
52:         flash[:notice] = t('account.contrasena_modificada')
53:         redirect_to(params[:return_to].blank? ? account_path : params[:return_to])
54:       else
55:         render :action => "pwd_edit", :layout => @layout
56:       end
57:     end
58:   end

[Source]

    # File app/controllers/account_controller.rb, line 7
 7:   def show
 8:     @title = t('account.mi_cuenta')
 9:     @breadcrumbs_info = [[t('account.mi_cuenta'), account_path]]
10:     
11:     if [Editor, Admin].include?(current_user.class)
12:       redirect_to admin_path and return
13:     end
14:     render :action => "show", :layout => @layout
15:   end

[Source]

    # File app/controllers/account_controller.rb, line 24
24:   def update
25:     @user = User.find(current_user.id)
26:     if @user.update_attributes(params[:user])
27:       redirect_to account_path
28:     else
29:       render :action => 'edit', :layout => @layout
30:     end
31:     
32:   end

[Validate]