Class: Lobby::ConfirmationController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Lobby::ConfirmationController
- Defined in:
- app/controllers/lobby/confirmation_controller.rb
Instance Method Summary collapse
- #new_email ⇒ Object
- #registration ⇒ Object
-
#resend_signup_token ⇒ Object
User has lost email with signup token.
Instance Method Details
#new_email ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/lobby/confirmation_controller.rb', line 33 def new_email @user = User.find_by_new_email_token( params[:token] ) unless params[:token].nil? if @user if @user.confirm_new_email! redirect_to( root_url, :notice => t( '.flash.success' )) else flash[:notice] = t( '.flash.error' ) end else render :new_email_token end end |
#registration ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/controllers/lobby/confirmation_controller.rb', line 4 def registration @user = User.where( :signup_token => params[:token] ).first unless params[:token].nil? if @user @user.confirm_signup! session[:user_id] = @user.id redirect_to :controller => "/home", :action => "index", flash: { success: t( '.flash.success' ) } else flash.now[:notice] = t( '.flash.error') if params[:token] end end |
#resend_signup_token ⇒ Object
User has lost email with signup token. we send this email again.
20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/lobby/confirmation_controller.rb', line 20 def resend_signup_token flash[:notice] = nil @user = User.find_by_email(params[:email]) if @user && @user.authenticate(params[:password]) if @user.resend_signup_token redirect_to log_in_url, flash: { success: t( '.flash.success' ) } else redirect_to log_in_url, flash: { danger: t( '.flash.error' ) } end end end |