Auth by username instead of email

Added username to User table/model
This commit is contained in:
Jason Denney
2013-05-25 11:08:58 -04:00
parent a07d6345e8
commit 9021294c4b
9 changed files with 25 additions and 7 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ class AppTabPanel < Netzke::Basepack::TabPanel
action :sign_out do |c|
c.icon = :door_out
c.text = "Sign out #{controller.current_user.email}" if controller.current_user
c.text = "Exit" if controller.current_user
end
def configure(c)
+1
View File
@@ -4,6 +4,7 @@ class UserStats < Netzke::Base
bike = user.bike
%Q(
<div id="user_stats_page">
<p>Username: #{user.username}</p>
<p>Total Hours Worked: #{user.total_hours}</p>
<p>Hours worked in #{Time.now.strftime('%B')}: #{user.current_month_hours}</p>
<p>Current bike Shop ID: #{bike.shop_id if bike}</p>
+1
View File
@@ -5,6 +5,7 @@ class Users < Netzke::Basepack::Grid
c.model = "User"
c.columns = [
:username,
:first_name,
:last_name,
:nickname,
@@ -2,6 +2,10 @@
%h2 Sign up
= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f|
= devise_error_messages!
%div
= f.label :username
%br/
= f.text_field :username
%div
= f.label :first_name
%br/
+4 -4
View File
@@ -3,8 +3,8 @@
<h2>Sign in</h2>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.label :username%><br />
<%= f.text_field :username%></div>
<div><%= f.label :password %><br />
<%= f.password_field :password %></div>
@@ -21,9 +21,9 @@
<% if Rails.env.development? %>
<% User.all.each do |user| %>
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
<%= f.hidden_field :email, :value => user.email %></div>
<%= f.hidden_field :username, :value => user.username%></div>
<%= f.hidden_field :password, :value => 'password' %></div>
<div><%= f.submit "Sign in as #{user.email}" %></div>
<div><%= f.submit "Sign in as #{user.username}" %></div>
<% end %>
<% end %>
<% end %>