tb_core 1.1.1 → 1.1.2
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/admin/application_controller.rb +2 -2
- data/app/controllers/admin/password_resets_controller.rb +2 -1
- data/app/controllers/admin/settings_controller.rb +9 -5
- data/app/controllers/admin/setup_controller.rb +1 -1
- data/app/controllers/admin/user_sessions_controller.rb +1 -1
- data/app/controllers/password_resets_controller.rb +1 -0
- data/app/helpers/twice_baked/application_helper.rb +14 -0
- data/app/views/admin/password_resets/index.html.erb +9 -9
- data/app/views/admin/settings/edit.html.erb +2 -1
- data/app/views/layouts/admin/application.html.erb +2 -2
- data/app/views/password_resets/index.html.erb +4 -4
- data/app/views/password_resets/show.html.erb +9 -18
- data/app/views/user_sessions/new.html.erb +6 -15
- data/lib/spud_core/version.rb +1 -1
- data/spec/controllers/admin/settings_controller_spec.rb +1 -1
- data/spec/dummy/log/test.log +4646 -0
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                NmRmYjc1MWEzZWMyZTAzZmVkNTc2ZGFjZDczOTIyN2VhMDU0OTVhNQ==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                YTBhYjFhOTIxNzA5ZjNmZTY2M2YzZjBkNTQwYjEwMWM5MTU0NmM3Ng==
         | 
| 7 7 | 
             
            !binary "U0hBNTEy":
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                ZTAyNDhiNzNjNWY3NGI0ZGM5N2I4ZTYyZTNkODMxZTI2MTU0NDg1OTgxOTEz
         | 
| 10 | 
            +
                NDcxOGZkMGYxMDVlMTE1ZjcwMmYzZmI5MjZlZjk1Yjc0ZWM1YmMyZTljYjE4
         | 
| 11 | 
            +
                MDM4ZTI2ZDJiOTRlYmUyNGI1MDAyOTVkZTE0ZjFkODU5ODEyZTQ=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                MjEwNjUyZmNkYTQ5OTMxYjg1ZjE4NDBjODUzZDRmYTA1ZmZjYzFkOGFjYzc5
         | 
| 14 | 
            +
                ZDg3MjVjNzMyZDFkNjIzNjU5YzdiMDhiNmYyODBiM2RlMWI4ZDQwMzQzOWVl
         | 
| 15 | 
            +
                ODM2YWUzMjM5ODI5NWQ1MDY0YWExNTU1NzJiMWM3M2FmODdjYTA=
         | 
| @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            class Admin::ApplicationController < Spud::ApplicationController
         | 
| 2 2 |  | 
| 3 | 
            -
              before_filter : | 
| 3 | 
            +
              before_filter :require_admin_user
         | 
| 4 4 | 
             
              before_filter :verify_site_mode
         | 
| 5 5 | 
             
              add_breadcrumb "Dashboard", :admin_root_path
         | 
| 6 6 | 
             
              layout 'admin/detail'
         | 
| @@ -21,7 +21,7 @@ class Admin::ApplicationController < Spud::ApplicationController | |
| 21 21 |  | 
| 22 22 | 
             
            private
         | 
| 23 23 |  | 
| 24 | 
            -
              def  | 
| 24 | 
            +
              def require_admin_user
         | 
| 25 25 | 
             
                if current_user.blank?
         | 
| 26 26 | 
             
                  flash[:notice] = "You must be logged in to access the requested page"
         | 
| 27 27 | 
             
                  redirect_to admin_login_path
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            class Admin::PasswordResetsController < Admin::ApplicationController
         | 
| 2 2 |  | 
| 3 3 | 
             
              before_filter :load_user_using_perishable_token, :only => [:show, :update]
         | 
| 4 | 
            -
              skip_before_filter :require_user
         | 
| 4 | 
            +
              skip_before_filter :require_user, :require_admin_user
         | 
| 5 5 | 
             
              layout 'admin/login'
         | 
| 6 6 |  | 
| 7 7 | 
             
              def index
         | 
| @@ -11,6 +11,7 @@ class Admin::PasswordResetsController < Admin::ApplicationController | |
| 11 11 | 
             
              def create
         | 
| 12 12 | 
             
                @user = SpudUser.find_by_email(params[:email])
         | 
| 13 13 | 
             
                if @user
         | 
| 14 | 
            +
                  @user.reset_perishable_token!
         | 
| 14 15 | 
             
                  CoreMailer.forgot_password_notification(@user, admin_password_reset_url(@user.perishable_token)).deliver
         | 
| 15 16 | 
             
                  flash[:notice] = "Instructions to reset your password have been emailed to you. " +
         | 
| 16 17 | 
             
                  "Please check your email."
         | 
| @@ -1,7 +1,13 @@ | |
| 1 1 | 
             
            class Admin::SettingsController < Admin::ApplicationController
         | 
| 2 2 |  | 
| 3 | 
            -
               | 
| 4 | 
            -
               | 
| 3 | 
            +
              before_filter :require_user
         | 
| 4 | 
            +
              skip_before_filter :require_admin_user
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              before_filter do |c|
         | 
| 7 | 
            +
                if current_user && current_user.has_admin_rights?
         | 
| 8 | 
            +
                  add_breadcrumb "Settings", :admin_settings_path
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
              end
         | 
| 5 11 |  | 
| 6 12 | 
             
              def edit
         | 
| 7 13 |  | 
| @@ -10,10 +16,8 @@ class Admin::SettingsController < Admin::ApplicationController | |
| 10 16 | 
             
              def update
         | 
| 11 17 | 
             
                if @current_user.update_attributes(params[:spud_user].slice :login,:first_name,:last_name,:email,:password,:password_confirmation,:time_zone)
         | 
| 12 18 | 
             
                  flash[:notice] = "User settings saved successfully."
         | 
| 13 | 
            -
                  redirect_to admin_root_path
         | 
| 14 | 
            -
                else
         | 
| 15 | 
            -
                  render 'edit'
         | 
| 16 19 | 
             
                end
         | 
| 20 | 
            +
                render 'edit'
         | 
| 17 21 | 
             
              end
         | 
| 18 22 |  | 
| 19 23 | 
             
            end
         | 
| @@ -11,6 +11,7 @@ class PasswordResetsController < ApplicationController | |
| 11 11 | 
             
              def create
         | 
| 12 12 | 
             
                @user = SpudUser.find_by_email(params[:email])
         | 
| 13 13 | 
             
                if @user
         | 
| 14 | 
            +
                  @user.reset_perishable_token!
         | 
| 14 15 | 
             
                  CoreMailer.forgot_password_notification(@user, password_reset_url(@user.perishable_token)).deliver
         | 
| 15 16 | 
             
                  flash[:notice] = "Password reset instructions have been sent to your email"
         | 
| 16 17 | 
             
                  redirect_to login_path
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            module TwiceBaked::ApplicationHelper
         | 
| 2 | 
            +
             | 
| 3 | 
            +
              def tb_form_errors(record)
         | 
| 4 | 
            +
                if record.errors.any?
         | 
| 5 | 
            +
                  content_tag :div, :class => 'form-errors' do
         | 
| 6 | 
            +
                    concat(content_tag :h4, "Please correct the following #{pluralize(record.errors.size, 'error')}:")
         | 
| 7 | 
            +
                    concat(raw "<ul>")
         | 
| 8 | 
            +
                    concat(raw record.errors.full_messages.collect{ |msg| "<li>#{msg}</li>" }.join())
         | 
| 9 | 
            +
                    concat(raw "</ul>")
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            end
         | 
| @@ -1,10 +1,10 @@ | |
| 1 1 | 
             
            <% @login_title = 'Forgot Password' %>
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 2 | 
            +
            <%= form_tag admin_password_resets_path do  %>
         | 
| 3 | 
            +
              <div class="login-form-row">
         | 
| 4 | 
            +
            	  <%= label_tag :email %>
         | 
| 5 | 
            +
            	  <%= text_field_tag :email %>
         | 
| 6 | 
            +
              </div>
         | 
| 7 | 
            +
              <div class="login-form-row">
         | 
| 8 | 
            +
              	<%= submit_tag "Send Reset Instructions", :class => 'btn' %> or <%= link_to 'Cancel', admin_login_path %>
         | 
| 9 | 
            +
              </div>
         | 
| 10 | 
            +
            <% end %>
         | 
| @@ -8,6 +8,7 @@ | |
| 8 8 | 
             
            <%= form_for @current_user, :url => admin_settings_path, :method => :put, :html => {:class => "form-horizontal"} do |f| %>
         | 
| 9 9 | 
             
              <%= render :partial => "form", :locals => {:f => f} %>
         | 
| 10 10 | 
             
              <div class="form-actions">
         | 
| 11 | 
            -
              	<%= f.submit "Save Settings", :class=>"btn btn-primary"%> or  | 
| 11 | 
            +
              	<%= f.submit "Save Settings", :class=>"btn btn-primary"%> or 
         | 
| 12 | 
            +
                <%=link_to "cancel", (@current_user.has_admin_rights? ? admin_root_path : root_path), :class => "btn" %>
         | 
| 12 13 | 
             
              </div>
         | 
| 13 14 | 
             
            <% end %>
         | 
| @@ -9,8 +9,8 @@ | |
| 9 9 | 
             
            </head>
         | 
| 10 10 | 
             
            <body>
         | 
| 11 11 | 
             
            <div id="header" style="<%=header_style%>">
         | 
| 12 | 
            -
            	<%= link_to  | 
| 13 | 
            -
                <h1><%= Spud::Core.config.site_name  | 
| 12 | 
            +
            	<%= link_to root_path do %>
         | 
| 13 | 
            +
                <h1><%= Spud::Core.config.site_name %></h1>
         | 
| 14 14 | 
             
              <% end %>
         | 
| 15 15 | 
             
              <% if current_user %>
         | 
| 16 16 | 
             
              	<div id="user_meta">
         | 
| @@ -1,11 +1,11 @@ | |
| 1 1 | 
             
            <h1>Password Reset</h1>
         | 
| 2 2 |  | 
| 3 | 
            -
            <%= form_tag password_resets_path, :class => ' | 
| 4 | 
            -
              <div class=" | 
| 3 | 
            +
            <%= form_tag password_resets_path, :class => 'password-reset-form' do  %>
         | 
| 4 | 
            +
              <div class="form-row">
         | 
| 5 5 | 
             
                <%= label_tag :email %>
         | 
| 6 | 
            -
                <%= text_field_tag :email %>
         | 
| 6 | 
            +
                <%= text_field_tag :email, params[:email], :placeholder => 'email' %>
         | 
| 7 7 | 
             
              </div>
         | 
| 8 | 
            -
              <div class=" | 
| 8 | 
            +
              <div class="form-row form-row-actions">
         | 
| 9 9 | 
             
                <%= submit_tag 'Submit', :class => 'btn btn-primary' %> or <%= link_to 'Cancel', login_path %>
         | 
| 10 10 | 
             
              </div>
         | 
| 11 11 | 
             
            <% end %>
         | 
| @@ -1,26 +1,17 @@ | |
| 1 1 | 
             
            <div class="login-form">
         | 
| 2 2 | 
             
            	<h1>Password Reset</h1>
         | 
| 3 | 
            -
            	<%= form_for @user, url | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
                  <h2>Please correct the following <%= pluralize(@user.errors.size, 'error') %>:</h2>
         | 
| 7 | 
            -
                  <ul>
         | 
| 8 | 
            -
                    <% @user.errors.full_messages.each do |msg| %>
         | 
| 9 | 
            -
                      <li><%= msg %></li>
         | 
| 10 | 
            -
                    <% end %>
         | 
| 11 | 
            -
                  </ul>
         | 
| 12 | 
            -
                </div>
         | 
| 13 | 
            -
              <% end %>
         | 
| 14 | 
            -
            	  <div class="field-group">
         | 
| 3 | 
            +
            	<%= form_for @user, :url => password_reset_path(:id => @user.perishable_token), :html => {:class => 'password-reset-form'} do |f| %>
         | 
| 4 | 
            +
                <%= tb_form_errors(@user) %>
         | 
| 5 | 
            +
            	  <div class="form-row">
         | 
| 15 6 | 
             
            	  	<%= f.label :password %>
         | 
| 16 | 
            -
            	  	<%= f.password_field :password %>
         | 
| 7 | 
            +
            	  	<%= f.password_field :password, :placeholder => 'password' %>
         | 
| 17 8 | 
             
            	  </div>
         | 
| 18 | 
            -
            	  <div class=" | 
| 19 | 
            -
            	  	<%= f.label :password_confirmation %>
         | 
| 20 | 
            -
            	  	<%= f.password_field :password_confirmation %>
         | 
| 9 | 
            +
            	  <div class="form-row">
         | 
| 10 | 
            +
            	  	<%= f.label :password_confirmation, 'Confirm password' %>
         | 
| 11 | 
            +
            	  	<%= f.password_field :password_confirmation, 'placeholder' => 'confirm password' %>
         | 
| 21 12 | 
             
            	  </div>
         | 
| 22 | 
            -
            	  <div class=" | 
| 23 | 
            -
            	  	<%= f.submit "Reset Password" %>
         | 
| 13 | 
            +
            	  <div class="form-row form-row-actions">
         | 
| 14 | 
            +
            	  	<%= f.submit "Reset Password", :class => 'btn btn-primary' %>
         | 
| 24 15 | 
             
            	  </div>
         | 
| 25 16 | 
             
            	<% end %>
         | 
| 26 17 | 
             
            </div>
         | 
| @@ -1,25 +1,16 @@ | |
| 1 | 
            -
            <h1 | 
| 1 | 
            +
            <h1><%= Spud::Core.config.site_name %> Login</h1>
         | 
| 2 2 |  | 
| 3 | 
            -
            <%= form_for @user_session, :url => login_path, :html => {:class => ' | 
| 4 | 
            -
               | 
| 5 | 
            -
                <div class="form-errors">
         | 
| 6 | 
            -
                  <h2>Please correct the following <%= pluralize(@user_session.errors.size, 'error') %>:</h2>
         | 
| 7 | 
            -
                  <ul>
         | 
| 8 | 
            -
                    <% @user_session.errors.full_messages.each do |msg| %>
         | 
| 9 | 
            -
                      <li><%= msg %></li>
         | 
| 10 | 
            -
                    <% end %>
         | 
| 11 | 
            -
                  </ul>
         | 
| 12 | 
            -
                </div>
         | 
| 13 | 
            -
              <% end %>
         | 
| 3 | 
            +
            <%= form_for @user_session, :url => login_path, :html => {:class => 'login-form'} do |f| %>
         | 
| 4 | 
            +
              <%= tb_form_errors(@user_session) %>
         | 
| 14 5 | 
             
              <div class="form-row">
         | 
| 15 6 | 
             
                <%= f.label :login %>
         | 
| 16 | 
            -
                <%= f.text_field :login %>
         | 
| 7 | 
            +
                <%= f.text_field :login, :placeholder => 'username' %>
         | 
| 17 8 | 
             
              </div>
         | 
| 18 9 | 
             
              <div class="form-row">
         | 
| 19 10 | 
             
                <%= f.label :password %>
         | 
| 20 | 
            -
                <%= f.password_field :password %>
         | 
| 11 | 
            +
                <%= f.password_field :password, :placeholder => 'password' %>
         | 
| 21 12 | 
             
              </div>
         | 
| 22 13 | 
             
              <div class="form-row">
         | 
| 23 | 
            -
                <%= f.submit "Login", :class => 'btn btn-primary' %> or <%=link_to "Forgot Password?", password_resets_path %>
         | 
| 14 | 
            +
                <%= f.submit "Login", :class => 'btn btn-primary' %> <span>or</span> <%=link_to "Forgot Password?", password_resets_path %>
         | 
| 24 15 | 
             
              </div>
         | 
| 25 16 | 
             
            <% end %>
         | 
    
        data/lib/spud_core/version.rb
    CHANGED
    
    
| @@ -18,7 +18,7 @@ describe Admin::SettingsController do | |
| 18 18 | 
             
              describe :update do
         | 
| 19 19 | 
             
                it "should redirect to the admin root with a successful update" do
         | 
| 20 20 | 
             
                  put :update, :spud_user => {:first_name => "Mike"}
         | 
| 21 | 
            -
                  response.should  | 
| 21 | 
            +
                  response.should render_template('edit')
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                it "should put a message in the flash notice" do
         |