Class: Lobby::PasswordForgottenController

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

Instance Method Summary collapse

Instance Method Details

#check_tokenObject



35
36
37
38
39
40
41
42
43
# File 'app/controllers/lobby/password_forgotten_controller.rb', line 35

def check_token
  @token = params[:token]
  @password_forgotten_form = PasswordForgottenForm.new(@token)

  if @password_forgotten_form.user.blank?
    render :recover_password_auth
    false
  end
end

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/lobby/password_forgotten_controller.rb', line 9

def create
  if @password_forgotten_form.submit(password_forgotten_form_params)
    flash[:success] = t('.notice.success')
    redirect_to 
  else
    render "new"
  end
end

#newObject



6
7
# File 'app/controllers/lobby/password_forgotten_controller.rb', line 6

def new
end

#order_new_passwordObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/lobby/password_forgotten_controller.rb', line 18

def order_new_password
  if params[:email].present?
    @user = User.where( :email => params[:email] ).first
    if @user
      @user.send_password_reset
      # nothing special. Send always the same notice. so you can prevent from e-mail-guessing.
    else
      puts "*******************************"
      puts "An non-existing email was given"
      puts "*******************************"
    end
    flash[:success] = t( '.flash.success' )
    redirect_to 
  end
end

#password_forgotten_form_paramsObject



45
46
47
# File 'app/controllers/lobby/password_forgotten_controller.rb', line 45

def password_forgotten_form_params
  params.require(:password_forgotten_form).permit(:new_password, :new_password_confirmation)
end