rsvp 0.2.0 → 0.2.1
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.
- checksums.yaml +8 -8
 - data/app/controllers/rsvp/session_controller.rb +17 -7
 - data/app/views/rsvp/session/index.html.erb +6 -4
 - data/lib/rsvp/version.rb +1 -1
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NDQ3Y2M4YzcwMTI4ZjA3YTk3ZjNmOTQzOTMwNDQ1YzY4NTA4N2ZmZQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                Mjg5MWZjYTZhNmY3MjBmMWJlZTM2YWZmZDY0NjgwMmU5ZWVmZmI1Yg==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZTFiMmQxZmExNzc5ZWM1ZmNhNzRhZTFmYWJkMTAxNTIxMzgyYTA0NmM2YzU3
         
     | 
| 
      
 10 
     | 
    
         
            +
                YTBjMjEyYTliZmU1MTQwMTRlODQyNTRmZGEyZmU2NDg3MTZkN2YyZjFlNzgw
         
     | 
| 
      
 11 
     | 
    
         
            +
                MjJjMzBkY2QxZmNhMjU3ZTEyODU1ODkwNDA5NmU3MzZlZGUzZTA=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ODZiZWE2NzU0M2I5YWRlNGE5MzljMDk2NzIwYTI1NzYzMDNmNjZhYzVjMGJl
         
     | 
| 
      
 14 
     | 
    
         
            +
                ZTQxNTJhNzcyN2NkNDNkOGFiMDY0Mzk2Mjk0OTg4MjM0ZjIxNGYzMTIyNDU5
         
     | 
| 
      
 15 
     | 
    
         
            +
                ZjkwYjNiMmFhNmE1MTdkNWJkNWUyMDk0ZTVkMDVhMmNiMDE4MmE=
         
     | 
| 
         @@ -2,7 +2,8 @@ module Rsvp 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class SessionController < ApplicationController
         
     | 
| 
       3 
3 
     | 
    
         
             
                skip_before_filter :require_session, :only => [:index, :create]
         
     | 
| 
       4 
4 
     | 
    
         
             
                before_filter :get_access_attempt
         
     | 
| 
       5 
     | 
    
         
            -
                before_filter : 
     | 
| 
      
 5 
     | 
    
         
            +
                before_filter :flash_message_when_locked, :only => [:index]
         
     | 
| 
      
 6 
     | 
    
         
            +
                before_filter :redirect_when_locked, :only => [:create]
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
                # GET /session
         
     | 
| 
       8 
9 
     | 
    
         
             
                def index; end
         
     | 
| 
         @@ -14,9 +15,12 @@ module Rsvp 
     | 
|
| 
       14 
15 
     | 
    
         
             
                    session[:invitation_id] = invitation.id
         
     | 
| 
       15 
16 
     | 
    
         
             
                    redirect_to (invitation.responses.any? ? show_response_index_path : response_index_path)
         
     | 
| 
       16 
17 
     | 
    
         
             
                  else
         
     | 
| 
       17 
     | 
    
         
            -
                     
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
                     
     | 
| 
      
 18 
     | 
    
         
            +
                    if exceeded_access_attempts?
         
     | 
| 
      
 19 
     | 
    
         
            +
                      redirect_when_locked
         
     | 
| 
      
 20 
     | 
    
         
            +
                    else
         
     | 
| 
      
 21 
     | 
    
         
            +
                      flash.alert = "Oops!! The code you entered is not valid. Please try again."
         
     | 
| 
      
 22 
     | 
    
         
            +
                      redirect_to root_path
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
       20 
24 
     | 
    
         
             
                  end
         
     | 
| 
       21 
25 
     | 
    
         
             
                end
         
     | 
| 
       22 
26 
     | 
    
         | 
| 
         @@ -37,15 +41,21 @@ module Rsvp 
     | 
|
| 
       37 
41 
     | 
    
         
             
                  @access_attempt ||= AccessAttempt.find_or_create_by(remote_ip: request.remote_ip)
         
     | 
| 
       38 
42 
     | 
    
         
             
                end
         
     | 
| 
       39 
43 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                def  
     | 
| 
      
 44 
     | 
    
         
            +
                def exceeded_access_attempts?
         
     | 
| 
       41 
45 
     | 
    
         
             
                  @access_attempt.record_attempt
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @access_attempt.locked?
         
     | 
| 
       42 
47 
     | 
    
         
             
                end
         
     | 
| 
       43 
48 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                def  
     | 
| 
      
 49 
     | 
    
         
            +
                def redirect_when_locked
         
     | 
| 
       45 
50 
     | 
    
         
             
                  if @access_attempt.locked?
         
     | 
| 
       46 
     | 
    
         
            -
                    flash[:alert] = "You surpassed the attempt threshold. You may try again on #{@access_attempt.locked_until.strftime('%B %d at %I:%M %p')}."
         
     | 
| 
       47 
51 
     | 
    
         
             
                    redirect_to root_path
         
     | 
| 
       48 
52 
     | 
    
         
             
                  end
         
     | 
| 
       49 
53 
     | 
    
         
             
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                def flash_message_when_locked
         
     | 
| 
      
 56 
     | 
    
         
            +
                  if @access_attempt.locked?
         
     | 
| 
      
 57 
     | 
    
         
            +
                    flash.now[:alert] = "You surpassed the attempt threshold. You may try again on #{@access_attempt.locked_until.strftime('%A, %B %d at %l:%M %p').gsub(/[\ ]{2}/, " ")}."
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
       50 
60 
     | 
    
         
             
              end
         
     | 
| 
       51 
61 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
              <%=  
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            <% unless @access_attempt.locked? %>
         
     | 
| 
      
 2 
     | 
    
         
            +
              <%= form_tag sign_in_path, :method => :post do |f| %>
         
     | 
| 
      
 3 
     | 
    
         
            +
                <%= label_tag :rsvp_code, "Enter your RSVP Code" %>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <%= text_field_tag :rsvp_code %>
         
     | 
| 
      
 5 
     | 
    
         
            +
                <%= submit_tag "Begin RSVP" %>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <% end %>
         
     | 
| 
       5 
7 
     | 
    
         
             
            <% end %>
         
     | 
    
        data/lib/rsvp/version.rb
    CHANGED