Permalink
Browse files

No need for users controller anymore.

  • Loading branch information...
josevalim committed Feb 8, 2010
1 parent 172d69c commit 18245d9b3a0d2531879bd8aae025b50abf2dc297
@@ -1,26 +0,0 @@
-class UsersController < ApplicationController
- before_filter :authenticate_user!
-
- def edit
- @user = current_user
- end
-
- def update
- @user = current_user
- # Could be splitted in two actions
- method = params[:user][:password] ? :update_with_password : :update_attributes
- if @user.send(method, params[:user])
- flash[:notice] = 'Updated successfully'
- redirect_to root_path
- else
- render :edit
- end
- end
-
- def destroy
- current_user.destroy
- sign_out current_user
- flash[:notice] = t('flash.users.destroy.notice', :default => 'User was successfully destroyed.')
- redirect_to root_path
- end
-end
@@ -1,8 +1,12 @@
<h1>Hello!</h1>
+
<% unless admin_signed_in? -%>
+ <p><%= link_to 'Sign up as Admin', new_admin_registration_path %></p>
<p><%= link_to 'Sign in as Admin', new_admin_session_path %></p>
<% end -%>
+
<% unless user_signed_in? -%>
+ <p><%= link_to 'Sign up as User', new_user_registration_path %></p>
<p><%= link_to 'Sign in as User', new_user_session_path %></p>
<% end -%>
@@ -17,7 +17,7 @@
<% if user_signed_in? -%>
<div id="user_login_box" style="float:right">
<%= current_user.email %> |
- <%= link_to 'My info', edit_user_path %> |
+ <%= link_to 'My info', edit_user_registration_path %> |
<%= link_to 'Sign out', destroy_user_session_path %>
</div>
<% end -%>
@@ -1,32 +0,0 @@
-<% title 'Editing My Info' -%>
-
-<% form_for @user, :url => user_path do |f| -%>
- <% field_set_tag 'Update my email' do -%>
- <p><%= f.text_field :email %></p>
- <%= error_message_on @user, :email %>
- <p class="submit"><%= f.submit 'Update email' %></p>
- <% end -%>
-<% end -%>
-
-<% form_for @user, :url => user_path do |f| -%>
- <% field_set_tag 'Update my password' do -%>
- <p>
- <%= f.label :old_password, 'Your actual password, please' %><br />
- <%= f.password_field :old_password %>
- </p>
- <%= error_message_on @user, :old_password %>
- <p>
- <%= f.label :password, 'What password do you want?' %><br />
- <%= f.password_field :password %>
- </p>
- <%= error_message_on @user, :password %>
- <p>
- <%= f.label :password_confirmation, 'Confirm the new password' %><br />
- <%= f.password_field :password_confirmation %>
- </p>
- <%= error_message_on @user, :password_confirmation %>
- <p class="submit"><%= f.submit 'Update password' %></p>
- <% end -%>
-<% end -%>
-
-<%= link_to "Cancel my account", user_path, :method => :delete, :confirm => "Are you sure?" %>
View
@@ -2,7 +2,6 @@
map.devise_for :users, :admin
map.resources :home, :only => :index
- map.resource :user
map.resources :admins, :only => [:index]
map.root :controller => :home
View
@@ -12,17 +12,17 @@
ActiveRecord::Schema.define(:version => 20091009223419) do
create_table "admins", :force => true do |t|
- t.string "email", :limit => 100, :null => false
- t.string "encrypted_password", :limit => 40, :null => false
- t.string "password_salt", :limit => 20, :null => false
+ t.string "email", :null => false
+ t.string "encrypted_password", :limit => 40, :null => false
+ t.string "password_salt", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", :force => true do |t|
- t.string "email", :limit => 100, :null => false
- t.string "encrypted_password", :limit => 40, :null => false
- t.string "password_salt", :limit => 20, :null => false
+ t.string "email", :null => false
+ t.string "encrypted_password", :limit => 40, :null => false
+ t.string "password_salt", :null => false
t.string "confirmation_token", :limit => 20
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
@@ -34,7 +34,7 @@
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
- t.integer "failed_attempts", :default => 0
+ t.integer "failed_attempts", :default => 0
t.string "unlock_token", :limit => 20
t.datetime "locked_at"
t.datetime "created_at"

0 comments on commit 18245d9

Please sign in to comment.