lobby 0.0.25 → 0.0.26

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.
@@ -6,7 +6,8 @@ module Lobby
6
6
 
7
7
  if @user
8
8
  @user.confirm_signup!
9
- redirect_to log_in_url, flash: { success: t( '.flash.success' ) }
9
+ session[:user_id] = @user.id
10
+ redirect_to root_url, flash: { success: t( '.flash.success' ) }
10
11
  else
11
12
  flash.now[:notice] = t( '.flash.error') if params[:token]
12
13
  end
@@ -0,0 +1,47 @@
1
+ module Lobby
2
+ class ConfirmationController < ApplicationController
3
+
4
+ def registration
5
+ @user = User.where( :signup_token => params[:token] ).first unless params[:token].nil?
6
+
7
+ if @user
8
+ @user.confirm_signup!
9
+ session[:user_id] = @user.id
10
+ redirect_to root_url, flash: { success: t( '.flash.success' ) }
11
+ else
12
+ flash.now[:notice] = t( '.flash.error') if params[:token]
13
+ end
14
+ end
15
+
16
+ #
17
+ # User has lost email with signup token. we send this email again.
18
+ #
19
+
20
+ def resend_signup_token
21
+ flash[:notice] = nil
22
+ @user = User.find_by_email(params[:email])
23
+ if @user && @user.authenticate(params[:password])
24
+ if @user.resend_signup_token
25
+ redirect_to log_in_url, flash: { success: t( '.flash.success' ) }
26
+ else
27
+ redirect_to log_in_url, flash: { danger: t( '.flash.error' ) }
28
+ end
29
+ end
30
+ end
31
+
32
+
33
+ def new_email
34
+ @user = User.find_by_new_email_token( params[:token] ) unless params[:token].nil?
35
+ if @user
36
+ if @user.confirm_new_email!
37
+ redirect_to( root_url, :notice => t( '.flash.success' ))
38
+ else
39
+ flash[:notice] = t( '.flash.error' )
40
+ end
41
+ else
42
+ render :new_email_token
43
+ end
44
+ end
45
+
46
+ end
47
+ end
@@ -8,8 +8,8 @@ module Lobby
8
8
  def create
9
9
  @user = User.new(user_params)
10
10
  if @user.save
11
- redirect_to log_in_url, flash: {success: t( '.success' ) }
12
11
  @user.send_registration
12
+ redirect_to log_in_url, flash: {success: t( '.success' ) }
13
13
  else
14
14
  render :new
15
15
  end
@@ -0,0 +1,23 @@
1
+ module Lobby
2
+ class UsersController < ApplicationController
3
+
4
+ def new
5
+ @user = User.new
6
+ end
7
+
8
+ def create
9
+ @user = User.new(user_params)
10
+ if @user.save
11
+ redirect_to log_in_url, flash: {success: t( '.success' ) }
12
+ @user.send_registration
13
+ else
14
+ render :new
15
+ end
16
+ end
17
+
18
+ def user_params
19
+ params.require(:user).permit(:email, :username, :password, :password_confirmation)
20
+ end
21
+
22
+ end
23
+ end
@@ -1,3 +1,3 @@
1
1
  module Lobby
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Lobby
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
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.25
4
+ version: 0.0.26
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: 2014-03-18 00:00:00.000000000 Z
12
+ date: 2014-03-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -230,10 +230,12 @@ files:
230
230
  - app/mailers/lobby/confirmation_mailer.rb
231
231
  - app/assets/stylesheets/lobby/application.css
232
232
  - app/assets/javascripts/lobby/application.js
233
+ - app/controllers/lobby/users_controller.rb~
233
234
  - app/controllers/lobby/application_controller.rb
234
235
  - app/controllers/lobby/confirmation_controller.rb
235
236
  - app/controllers/lobby/password_forgotten_controller.rb~
236
237
  - app/controllers/lobby/users_controller.rb
238
+ - app/controllers/lobby/confirmation_controller.rb~
237
239
  - app/controllers/lobby/sessions_controller.rb
238
240
  - app/controllers/lobby/password_forgotten_controller.rb
239
241
  - app/helpers/lobby/application_helper.rb