Commit 4b5bf422

mo khan <mo@mokhan.ca>
2014-09-18 03:56:25
remove password confirmation from registration.
1 parent 0f2c984
Changed files (3)
app
views
config
spec
app/views/sessions/new.html.erb
@@ -33,7 +33,7 @@
           <br />
           <label for="checkbox" class="checkbox"> <%= check_box_tag 'session[remember_me]' %> Remember me <%= link_to "Forgot your password?", new_password_path(:user) %></label>
         <% end %>
-        <%= form_for(User.new, as: :user, url: registration_path(:user), html: { :class=> 'form-horizontal' }) do |f| %>
+        <%= form_for(User.new, as: :user, url: registration_path, html: { :class=> 'form-horizontal' }) do |f| %>
           <fieldset>
             <legend>New to CakeSide? Join Us!</legend>
           </fieldset>
@@ -55,12 +55,6 @@
               <%= f.password_field :password, :placeholder => 'required' %>
             </div>
           </div>
-          <div class="control-group">
-            <%= f.label :password_confirmation, 'Confirm password', :class => "control-label" %>
-            <div class="controls">
-              <%= f.password_field :password_confirmation, :placeholder => 'required' %>
-            </div>
-          </div>
           <div class="control-group">
             <label for="accepted" class="control-label"></label>
             <div class="controls">
config/routes.rb
@@ -53,7 +53,7 @@ Cake::Application.routes.draw do
   # /users
   #devise_for :users, :controllers => {:registrations => 'registrations'}, :path => '', :path_names => { :sign_in => "signin", :sign_out => "signout", :sign_up => "register" }
   resources :passwords, only: [:new]
-  resource :registration
+  resource :registration, only: [:create]
 
   # sitemap
   get "/sitemap.xml", to: "sitemap#index", defaults: { format: :xml }
spec/controllers/registrations_controller_spec.rb
@@ -7,7 +7,7 @@ describe RegistrationsController do
     it 'creates a new user' do
       User.stub(:login).with('mo@cakeside.com', 'password').and_return(user_session)
 
-      post :create, user: { name: 'mo', email: 'mo@cakeside.com', password: 'password', password_confirmation: 'password' }
+      post :create, user: { name: 'mo', email: 'mo@cakeside.com', password: 'password' }
 
       expect(User.count).to eql(1)
       expect(response).to redirect_to(my_root_path)