Class: Lobby::ConfirmationController

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

Instance Method Summary collapse

Instance Method Details

#new_emailObject



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

#registrationObject



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_tokenObject

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 
  flash[:notice] = nil
  @user = User.find_by_email(params[:email])
  if @user && @user.authenticate(params[:password])
    if @user.
      redirect_to , flash: { success: t( '.flash.success' ) }
    else
      redirect_to , flash: { danger: t( '.flash.error' ) }
    end
  end
end