Class: Admin::AccountController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Admin::AccountController
- Defined in:
- app/controllers/admin/account_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 |
# File 'app/controllers/admin/account_controller.rb', line 14 def create user = Typus.user_class.generate(:email => params[:typus_user][:email]) redirect_to user ? { :action => "show", :id => user.token } : { :action => :new } end |
#forgot_password ⇒ Object
19 |
# File 'app/controllers/admin/account_controller.rb', line 19 def forgot_password; end |
#new ⇒ Object
10 11 12 |
# File 'app/controllers/admin/account_controller.rb', line 10 def new flash[:notice] = Typus::I18n.t("Enter your email below to create the first user.") end |
#send_password ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/controllers/admin/account_controller.rb', line 21 def send_password if user = Typus.user_class.find_by_email(params[:typus_user][:email]) Admin::Mailer.reset_password_instructions(user).deliver redirect_to new_admin_session_path, :notice => Typus::I18n.t("Password recovery link sent to your email.") else render :action => :forgot_password end end |
#show ⇒ Object
30 31 32 33 34 35 |
# File 'app/controllers/admin/account_controller.rb', line 30 def show flash[:notice] = Typus::I18n.t("Please set a new password.") typus_user = Typus.user_class.find_by_token!(params[:id]) session[:typus_user_id] = typus_user.id redirect_to params[:return_to] || { :controller => "/admin/#{Typus.user_class.to_resource}", :action => "edit", :id => typus_user.id } end |