Class: UsersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- UsersController
- Defined in:
- app/controllers/users_controller.rb
Instance Method Summary collapse
- #confirm ⇒ Object
- #create ⇒ Object
- #edit ⇒ Object
- #new ⇒ Object
- #resend_confirmation ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#confirm ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/users_controller.rb', line 39 def confirm @user = User.find_using_perishable_token params[:token] if @user @user.confirmed_at = Time.now @user.save UserSession.create @user flash[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.users.confirm.success_flash") redirect_to Rails.application.config.constellation.authentication.confirm_redirection else flash.now[Rails.application.config.constellation.authentication.failure_flash] = t("constellation.authentication.users.confirm.failure_flash") redirect_to resend_confirmation_path end end |
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/users_controller.rb', line 9 def create @user = User.new(params[:user]) if @user.save UserMailer.confirmation(@user).deliver if Rails.application.config.constellation.authentication.confirm_signup flash[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.users.create.success_flash") redirect_to Rails.application.config.constellation.authentication.signup_redirection else render :action => :new end end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/users_controller.rb', line 24 def edit @user = @current_user end |
#new ⇒ Object
5 6 7 |
# File 'app/controllers/users_controller.rb', line 5 def new @user = User.new end |
#resend_confirmation ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/users_controller.rb', line 53 def resend_confirmation if request.post? @user = User.find_by_email params[:email] if @user @user.reset_perishable_token! UserMailer.confirmation(@user).deliver flash.now[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.users.resend_confirmation.success_flash") redirect_to Rails.application.config.constellation.authentication.resend_confirmation_redirection else flash.now[Rails.application.config.constellation.authentication.failure_flash] = t("constellation.authentication.users.resend_confirmation.failure_flash") end end end |
#show ⇒ Object
20 21 22 |
# File 'app/controllers/users_controller.rb', line 20 def show @user = @current_user end |
#update ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/users_controller.rb', line 28 def update @user = @current_user if @user.update_attributes(params[:user]) flash[Rails.application.config.constellation.authentication.success_flash] = t("constellation.authentication.users.update.success_flash") redirect_to account_url else render :action => :edit end end |