Commit d47f27bf

mo khan <mo@mokhan.ca>
2014-08-15 04:32:46
change usages of new_session_path with login_path
1 parent 4067db9
app/controllers/application_controller.rb
@@ -35,7 +35,7 @@ class ApplicationController < ActionController::Base
   end
 
   def authenticate!
-    redirect_to new_session_path unless user_session
+    redirect_to login_path unless user_session
   end
 
   def extend_session_cookie
app/controllers/sessions_controller.rb
@@ -9,7 +9,7 @@ class SessionsController < ApplicationController
       redirect_to my_dashboard_path
     else
       flash[:error] = "invalid credentials"
-      redirect_to new_session_path
+      redirect_to login_path
     end
   end
 
app/views/creations/index.html.erb
@@ -15,7 +15,7 @@
       <strong>Make</strong> cakes, <strong>sell</strong> cakes, or just <strong>love</strong> eating them? You've come to the right place!
       <strong>CakeSide</strong> is a free site to <strong>share</strong> your cake <strong>creations</strong> and <strong>ideas</strong> with other cake fanatics like yourself!</p><br/>
       <p style="text-align: center;">
-      Get your cakes featured on this page <%= link_to "Sign Up For Free!", new_session_path, class: "btn btn-primary btn-large" %> or <%= link_to "sign in", new_session_path %>
+      Get your cakes featured on this page <%= link_to "Sign Up For Free!", login_path, class: "btn btn-primary btn-large" %> or <%= link_to "sign in", new_session_path %>
       </p>
     </div>
   </div>
app/views/creations/show.html.erb
@@ -23,7 +23,7 @@
             <%= button_to "ADD TO FAVORITES", creation_favorites_path(:creation_id => @creation.id), :method => :post, :class => 'btn btn-primary', "data-event" => 'click-add-to-favorites' %>
       <% end %>
       <% else %>
-        <p><%= link_to "SIGN UP FOR FREE", new_session_path, :class => "btn btn-primary mix-link", "data-event" => 'click-sign-up' %></p>
+        <p><%= link_to "SIGN UP FOR FREE", login_path, :class => "btn btn-primary mix-link", "data-event" => 'click-sign-up' %></p>
       <% end %>
       </div>
       <div class="span3">
app/views/devise/shared/_links.erb
@@ -1,5 +1,5 @@
 <%- if controller_name != 'sessions' %>
-  <%= link_to "Sign in", new_session_path(resource_name) %><br />
+  <%= link_to "Sign in", main_app.login_path(resource_name) %><br />
 <% end -%>
 
 <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
@@ -22,4 +22,4 @@
   <%- resource_class.omniauth_providers.each do |provider| %>
     <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
   <% end -%>
-<% end -%>
\ No newline at end of file
+<% end -%>
app/views/layouts/_header.html.erb
@@ -11,7 +11,7 @@
             <a href="#" class="dropdown-toggle" data-toggle="dropdown">Creations<b class="caret"></b></a>
             <ul class="dropdown-menu">
               <li>
-              <%= link_to current_user ? my_root_path(anchor: 'cakes/new') : new_session_path do %>
+              <%= link_to current_user ? my_root_path(anchor: 'cakes/new') : login_path do %>
                 <i class="icon-edit icon-large"></i> Add Creation
               <% end %>
               </li>
@@ -69,7 +69,7 @@
         </ul>
         <ul class="nav pull-right">
           <li>
-            <%= link_to current_user ? my_root_path(anchor: 'cakes/new') : new_session_path do %>
+            <%= link_to current_user ? my_root_path(anchor: 'cakes/new') : login_path do %>
               <i class="icon-edit icon-large"></i> Add Creation
             <% end %>
           </li>
@@ -84,7 +84,7 @@
             <% end %>
           </li>
           <% else %>
-            <li> <%= link_to "Sign In", new_session_path %> </li>
+            <li> <%= link_to "Sign In", login_path %> </li>
           <% end %>
         </ul>
       </div>
spec/controllers/my/cakes_controller_spec.rb
@@ -16,7 +16,7 @@ describe My::CakesController do
   context "when not logged in" do
     it "redirects you to the home page" do
       get :index
-      response.should redirect_to(new_session_path)
+      response.should redirect_to(login_path)
     end
   end
 end
spec/controllers/my/passwords_controller_spec.rb
@@ -7,7 +7,7 @@ describe My::PasswordsController do
 
       it "should redirect you to the login page" do
         put :update, :id => user.id
-        response.should redirect_to(new_session_path)
+        response.should redirect_to(login_path)
       end
     end
 
spec/controllers/sessions_controller_spec.rb
@@ -37,7 +37,7 @@ describe SessionsController do
 
       it "returns an error" do
         post :create, session: { username: 'x', password: 'y' }
-        expect(response).to redirect_to(new_session_path)
+        expect(response).to redirect_to(login_path)
         expect(flash[:error]).to_not be_empty
       end
     end
spec/features/add_to_favorites_spec.rb
@@ -5,7 +5,7 @@ describe "adding a cake to your favorites", :js => true do
   let!(:me) { create(:user, :password => "password") }
 
   before :each do
-    visit new_session_path
+    visit login_path
     within('.form-inline') do
       fill_in('session_username', :with => me.email)
       fill_in('session_password', :with => "password")
spec/features/change_password_spec.rb
@@ -5,7 +5,7 @@ describe "changing my password" do
     let(:user) { create(:user, :password => "password") }
 
     before :each do
-      visit new_session_path
+      visit login_path
       within('.form-inline') do
         fill_in('session_username', :with => user.email)
         fill_in('session_password', :with => "password")
spec/features/change_profile_settings_spec.rb
@@ -4,7 +4,7 @@ describe "Change settings" do
   let(:user) { create(:user, :password => "password") }
 
   before :each do
-    visit new_session_path
+    visit login_path
     within('.form-inline') do
       fill_in('session_username', :with => user.email)
       fill_in('session_password', :with => "password")
spec/features/forgot_password_spec.rb
@@ -5,7 +5,7 @@ describe "password retrieval", :js => true do
     let(:user) { create(:user) }
 
     before :each do
-      visit new_session_path
+      visit login_path
       click_link "Forgot your password?"
       within "#new_user" do
         fill_in "user_email", :with => user.email
spec/features/logins_spec.rb
@@ -3,7 +3,7 @@ require 'rails_helper'
 describe "Logins" do
   describe "GET /login" do
     it "should be able to reach the login page" do
-      visit new_session_path
+      visit login_path
       page.should have_content("Got an account? Login!")
     end
 
@@ -11,7 +11,7 @@ describe "Logins" do
       let!(:user) { create(:user, :password => "password") }
 
       before :each do
-        visit new_session_path
+        visit login_path
         within('.form-inline') do
           fill_in('session_username', :with => user.email)
           fill_in('session_password', :with => "password")
@@ -30,7 +30,7 @@ describe "Logins" do
 
     context "when an email is not known", js: true do
       before :each do
-        visit new_session_path
+        visit login_path
         within('.form-inline') do
           fill_in('session_username', :with => 'test@example.com')
           fill_in('session_password', :with => 'password')
spec/features/registration_spec.rb
@@ -3,7 +3,7 @@ require "rails_helper"
 describe "Registration", :js => true do
   context "when an email is not registered" do
     before :each do
-      visit new_session_path
+      visit login_path
       within(".form-horizontal") do
         fill_in('user_name', :with => 'John Smith')
         fill_in('user_email',:with => Faker::Internet.email)
spec/features/upload_avatar_spec.rb
@@ -4,7 +4,7 @@ describe "uploading an avatar", js: true do
   let(:user) { create(:user, :password => "password") }
 
   before :each do
-    visit new_session_path
+    visit login_path
     within('.form-inline') do
       fill_in('session_username', :with => user.email)
       fill_in('session_password', :with => "password")
spec/features/upload_creation_spec.rb
@@ -6,7 +6,7 @@ describe "uploading a new creation", :js => true do
   let!(:category_2) { create(:category) }
 
   before :each do
-    visit new_session_path
+    visit login_path
     within('.form-inline') do
       fill_in('session_username', with: user.email)
       fill_in('session_password', with: "password")