lobby 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,8 @@ module Lobby
18
18
  def order_new_password
19
19
  if params[:email]
20
20
  @user = User.where( :email => params[:email] ).first
21
- if @user && @user.send_password_reset
21
+ if @user
22
+ @user.send_password_rest
22
23
  # nothing special. Send always the same notice. so you can prevent from e-mail-guessing.
23
24
  else
24
25
  puts "*******************************"
@@ -0,0 +1,48 @@
1
+ module Lobby
2
+ class PasswordForgottenController < ApplicationController
3
+
4
+ before_action :check_token, only: [:new, :create]
5
+
6
+ def new
7
+ end
8
+
9
+ def create
10
+ if @password_forgotten_form.submit(password_forgotten_form_params)
11
+ flash[:success] = t('.notice.success')
12
+ redirect_to log_in_url
13
+ else
14
+ render "new"
15
+ end
16
+ end
17
+
18
+ def order_new_password
19
+ if params[:email]
20
+ @user = User.where( :email => params[:email] ).first
21
+ if @user && @user.send_password_reset
22
+ # nothing special. Send always the same notice. so you can prevent from e-mail-guessing.
23
+ else
24
+ puts "*******************************"
25
+ puts "An non-existing email was given"
26
+ puts "*******************************"
27
+ end
28
+ flash[:success] = t( '.flash.success' )
29
+ redirect_to log_in_url
30
+ end
31
+ end
32
+
33
+
34
+ def check_token
35
+ @token = params[:token]
36
+ @password_forgotten_form = PasswordForgottenForm.new(@token)
37
+
38
+ if @password_forgotten_form.user.blank?
39
+ render :recover_password_auth
40
+ false
41
+ end
42
+ end
43
+
44
+ def password_forgotten_form_params
45
+ params.require(:password_forgotten_form).permit(:new_password, :new_password_confirmation)
46
+ end
47
+ end
48
+ end
data/config/routes.rb CHANGED
@@ -17,5 +17,5 @@ Lobby::Engine.routes.draw do
17
17
 
18
18
  resources :sessions
19
19
 
20
- default_url_options :host => 'localhost:3000'
20
+ # default_url_options :host => 'localhost:3000'
21
21
  end
data/config/routes.rb~ ADDED
@@ -0,0 +1,21 @@
1
+ Lobby::Engine.routes.draw do
2
+
3
+ root to: 'sessions#new'
4
+
5
+ post 'log_in' => 'sessions#create', as: 'log_in'
6
+ get 'log_in' => 'sessions#new', as: 'log_in_link'
7
+ match 'confirm/resend_confirmation' => 'confirmation#resend_signup_token', as: 'resend_signup_token', via: [:get, :post]
8
+ match 'confirm/:action(/:token)', :controller => :confirmation, as: 'confirm', via: [:get, :post]
9
+ post 'register' => 'users#create', as: 'sign_up'
10
+ get 'register' => 'users#new', as: 'sign_up_form'
11
+ get 'log_out' => 'sessions#destroy', as: 'log_out'
12
+
13
+ # forgotten password
14
+ get 'recover_password(/:token)' => 'password_forgotten#new', as: 'recover_password_form'
15
+ post 'recover_password' => 'password_forgotten#create', as: 'recover_password'
16
+ match 'request_password' => 'password_forgotten#order_new_password', as: 'order_new_password', via: [:get, :post]
17
+
18
+ resources :sessions
19
+
20
+ default_url_options :host => 'localhost:3000'
21
+ end
data/lib/lobby/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lobby
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Lobby
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lobby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-23 00:00:00.000000000 Z
12
+ date: 2013-12-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -232,6 +232,7 @@ files:
232
232
  - app/assets/javascripts/lobby/application.js
233
233
  - app/controllers/lobby/application_controller.rb
234
234
  - app/controllers/lobby/confirmation_controller.rb
235
+ - app/controllers/lobby/password_forgotten_controller.rb~
235
236
  - app/controllers/lobby/users_controller.rb
236
237
  - app/controllers/lobby/sessions_controller.rb
237
238
  - app/controllers/lobby/password_forgotten_controller.rb
@@ -240,6 +241,7 @@ files:
240
241
  - config/locales/de.yml
241
242
  - config/locales/en.yml
242
243
  - config/locales/en.bootstrap.yml
244
+ - config/routes.rb~
243
245
  - config/routes.rb
244
246
  - lib/lobby/engine.rb~
245
247
  - lib/lobby/auth_user.rb