lobby 0.0.2 → 0.0.3
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.
- data/app/controllers/lobby/sessions_controller.rb +5 -5
 - data/app/models/lobby/auth_user.rb +18 -0
 - data/app/models/lobby/auth_user.rb~ +19 -1
 - data/config/locales/de.yml +84 -464
 - data/config/locales/de.yml~ +78 -467
 - data/config/locales/en.yml +67 -76
 - data/config/locales/en.yml~ +88 -97
 - data/config/routes.rb +0 -2
 - data/config/routes.rb~ +21 -0
 - data/lib/generators/lobby/install_generator.rb +86 -0
 - data/lib/generators/lobby/install_generator.rb~ +86 -0
 - data/lib/generators/lobby/lobby_generator.rb~ +97 -0
 - data/lib/generators/templates/config/config.yml +31 -0
 - data/lib/generators/templates/config/initializers/action_mailer.rb +75 -0
 - data/lib/generators/templates/config/initializers/constants.rb +1 -0
 - data/lib/generators/templates/config/locales/de.yml +149 -0
 - data/lib/generators/templates/config/locales/en.yml +148 -0
 - data/{db/migrate/20131205180849_create_users.rb → lib/generators/templates/db/migrate/create_users.rb} +2 -2
 - data/lib/generators/templates/views/common/_form_errors.html.haml +6 -0
 - data/lib/generators/templates/views/confirmation/new_email_token.html.haml +10 -0
 - data/lib/generators/templates/views/confirmation/registration.html.haml +11 -0
 - data/lib/generators/templates/views/confirmation/registration.html.haml~ +15 -0
 - data/lib/generators/templates/views/confirmation/resend_signup_token.html.haml +13 -0
 - data/lib/generators/templates/views/confirmation/resend_signup_token.html.haml~ +17 -0
 - data/lib/generators/templates/views/confirmation_mailer/new_email_request.text.haml +1 -0
 - data/lib/generators/templates/views/confirmation_mailer/registration.text.haml +1 -0
 - data/lib/generators/templates/views/confirmation_mailer/resend_signup_token.text.haml +1 -0
 - data/lib/generators/templates/views/confirmation_mailer/send_password_reset.text.haml +1 -0
 - data/lib/generators/templates/views/password_forgotten/new.html.haml +17 -0
 - data/lib/generators/templates/views/password_forgotten/new.html.haml~ +21 -0
 - data/lib/generators/templates/views/password_forgotten/order_new_password.html.haml +9 -0
 - data/lib/generators/templates/views/password_forgotten/order_new_password.html.haml~ +13 -0
 - data/lib/generators/templates/views/password_forgotten/recover_password_auth.html.haml +9 -0
 - data/lib/generators/templates/views/sessions/new.html.haml +12 -0
 - data/lib/generators/templates/views/sessions/new.html.haml~ +12 -0
 - data/lib/generators/templates/views/users/new.html.haml +20 -0
 - data/lib/generators/templates/views/users/new.html.haml~ +20 -0
 - data/lib/lobby/engine.rb +8 -0
 - data/lib/lobby/engine.rb~ +12 -3
 - data/lib/lobby/version.rb +1 -1
 - data/lib/lobby/version.rb~ +1 -1
 - metadata +31 -3
 
| 
         @@ -9,25 +9,25 @@ module Lobby 
     | 
|
| 
       9 
9 
     | 
    
         
             
                    if @user.confirmed?
         
     | 
| 
       10 
10 
     | 
    
         
             
                      if @user.active?
         
     | 
| 
       11 
11 
     | 
    
         
             
                        session[:user_id] = @user.id
         
     | 
| 
       12 
     | 
    
         
            -
                        flash.now[:success] = t( ' 
     | 
| 
      
 12 
     | 
    
         
            +
                        flash.now[:success] = t( '.flash.success' )
         
     | 
| 
       13 
13 
     | 
    
         
             
                        redirect_to root_url
         
     | 
| 
       14 
14 
     | 
    
         
             
                      else
         
     | 
| 
       15 
     | 
    
         
            -
                        flash.now[:danger] = t( ' 
     | 
| 
      
 15 
     | 
    
         
            +
                        flash.now[:danger] = t( '.flash.error.not_active' )
         
     | 
| 
       16 
16 
     | 
    
         
             
                        redirect_to log_in_url
         
     | 
| 
       17 
17 
     | 
    
         
             
                      end
         
     | 
| 
       18 
18 
     | 
    
         
             
                    else
         
     | 
| 
       19 
     | 
    
         
            -
                      flash.now[:danger] = t( ' 
     | 
| 
      
 19 
     | 
    
         
            +
                      flash.now[:danger] = t( '.flash.error.not_confirmed' )
         
     | 
| 
       20 
20 
     | 
    
         
             
                      redirect_to confirm_url( :action => "registration" )
         
     | 
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
       22 
22 
     | 
    
         
             
                  else
         
     | 
| 
       23 
     | 
    
         
            -
                    flash.now[:danger] = t( ' 
     | 
| 
      
 23 
     | 
    
         
            +
                    flash.now[:danger] = t( '.flash.error.wrong_password_or_email' )
         
     | 
| 
       24 
24 
     | 
    
         
             
                    render :new
         
     | 
| 
       25 
25 
     | 
    
         
             
                  end
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
       28 
28 
     | 
    
         
             
                def destroy
         
     | 
| 
       29 
29 
     | 
    
         
             
                  session[:user_id] = nil
         
     | 
| 
       30 
     | 
    
         
            -
                  redirect_to root_url, flash: {success: t( ' 
     | 
| 
      
 30 
     | 
    
         
            +
                  redirect_to root_url, flash: {success: t( '.success' ) }
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         
             
            end
         
     | 
| 
         @@ -9,6 +9,9 @@ module Lobby 
     | 
|
| 
       9 
9 
     | 
    
         
             
                  base.validates :email, uniqueness: true, :unless => :confirmed_duplicate, :on => :create, if: Proc.new { |u| u.email.present? }
         
     | 
| 
       10 
10 
     | 
    
         
             
                  base.validates :password, length: { minimum: 5 }, :on => :create, if: Proc.new { |u| u.password.present? }
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
                  base.validates :username, presence: true
         
     | 
| 
      
 13 
     | 
    
         
            +
                  base.validates :username, uniqueness: true, :unless => :confirmed_duplicate_username, :on => :create
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       12 
15 
     | 
    
         
             
                  base.extend ClassMethods
         
     | 
| 
       13 
16 
     | 
    
         
             
                end
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
         @@ -22,6 +25,10 @@ module Lobby 
     | 
|
| 
       22 
25 
     | 
    
         
             
                    where(:email => email)
         
     | 
| 
       23 
26 
     | 
    
         
             
                  end
         
     | 
| 
       24 
27 
     | 
    
         | 
| 
      
 28 
     | 
    
         
            +
                  def with_username(username)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    where(:username => username)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
       25 
32 
     | 
    
         
             
                end
         
     | 
| 
       26 
33 
     | 
    
         | 
| 
       27 
34 
     | 
    
         | 
| 
         @@ -54,6 +61,17 @@ module Lobby 
     | 
|
| 
       54 
61 
     | 
    
         
             
                  self.active == true
         
     | 
| 
       55 
62 
     | 
    
         
             
                end
         
     | 
| 
       56 
63 
     | 
    
         | 
| 
      
 64 
     | 
    
         
            +
             # attr_accessible :username
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                def confirmed_duplicate_username(test_username = self.username)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  if ((User.confirmed.with_username(test_username).count == 0) ||
         
     | 
| 
      
 68 
     | 
    
         
            +
                      (User.with_username(test_username).count == 0))
         
     | 
| 
      
 69 
     | 
    
         
            +
                    true
         
     | 
| 
      
 70 
     | 
    
         
            +
                  else
         
     | 
| 
      
 71 
     | 
    
         
            +
                    false
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       57 
75 
     | 
    
         
             
                # Wenn der User sich registriert, dann wird ein signup_token für ihn hinterlegt.
         
     | 
| 
       58 
76 
     | 
    
         
             
                # Dieser Token wird per Mail verschickt. Der User kann sich nun per Klick auf den
         
     | 
| 
       59 
77 
     | 
    
         
             
                # Tokenlink verifizieren. Sollte die Mail nicht mehr erreichbar sein, so kann der User
         
     | 
| 
         @@ -9,6 +9,9 @@ module Lobby 
     | 
|
| 
       9 
9 
     | 
    
         
             
                  base.validates :email, uniqueness: true, :unless => :confirmed_duplicate, :on => :create, if: Proc.new { |u| u.email.present? }
         
     | 
| 
       10 
10 
     | 
    
         
             
                  base.validates :password, length: { minimum: 5 }, :on => :create, if: Proc.new { |u| u.password.present? }
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
                  base.validates :username, presence: true
         
     | 
| 
      
 13 
     | 
    
         
            +
                  base.validates :username, uniqueness: true, :unless => :confirmed_duplicate_username, :on => :create
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       12 
15 
     | 
    
         
             
                  base.extend ClassMethods
         
     | 
| 
       13 
16 
     | 
    
         
             
                end
         
     | 
| 
       14 
17 
     | 
    
         | 
| 
         @@ -54,6 +57,21 @@ module Lobby 
     | 
|
| 
       54 
57 
     | 
    
         
             
                  self.active == true
         
     | 
| 
       55 
58 
     | 
    
         
             
                end
         
     | 
| 
       56 
59 
     | 
    
         | 
| 
      
 60 
     | 
    
         
            +
             # attr_accessible :username
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                def confirmed_duplicate_username(test_username = self.username)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  if ((User.confirmed.with_username(test_username).count == 0) ||
         
     | 
| 
      
 64 
     | 
    
         
            +
                      (User.with_username(test_username).count == 0))
         
     | 
| 
      
 65 
     | 
    
         
            +
                    true
         
     | 
| 
      
 66 
     | 
    
         
            +
                  else
         
     | 
| 
      
 67 
     | 
    
         
            +
                    false
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                def self.with_username(username)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  where(:username => username)
         
     | 
| 
      
 73 
     | 
    
         
            +
                end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
       57 
75 
     | 
    
         
             
                # Wenn der User sich registriert, dann wird ein signup_token für ihn hinterlegt.
         
     | 
| 
       58 
76 
     | 
    
         
             
                # Dieser Token wird per Mail verschickt. Der User kann sich nun per Klick auf den
         
     | 
| 
       59 
77 
     | 
    
         
             
                # Tokenlink verifizieren. Sollte die Mail nicht mehr erreichbar sein, so kann der User
         
     | 
| 
         @@ -65,7 +83,7 @@ module Lobby 
     | 
|
| 
       65 
83 
     | 
    
         
             
                # Confirmation-Token generiert und verschickt werden.
         
     | 
| 
       66 
84 
     | 
    
         | 
| 
       67 
85 
     | 
    
         
             
                def tokenmail(request)
         
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
      
 86 
     | 
    
         
            +
                  ConfirmationMailer.send(request, self).deliver
         
     | 
| 
       69 
87 
     | 
    
         
             
                end
         
     | 
| 
       70 
88 
     | 
    
         | 
| 
       71 
89 
     | 
    
         
             
                def send_password_reset(with_mail = true)
         
     |