Changeset 270

Show
Ignore:
Timestamp:
03/07/08 17:57:01 (6 months ago)
Author:
gdagley
Message:

rename login to username
remove signup, activation email templates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • incubator/jumpstart/app/views/sessions/new.html.erb

    r251 r270  
    66<% form_tag session_path do -%> 
    77  <p> 
    8     <label for="login">Email</label><br/> 
     8    <label for="email">Email</label><br/> 
    99    <%= text_field_tag 'email' %> 
    1010  </p> 
  • incubator/jumpstart/app/views/users/new.html.erb

    r251 r270  
    88<% form_for :user, :url => users_path do |f| -%> 
    99  <p> 
    10     <label for="login">Login</label><br/> 
    11     <%= f.text_field :login %> 
     10    <label for="username">Username</label><br/> 
     11    <%= f.text_field :username %> 
    1212  </p> 
    1313 
  • incubator/jumpstart/db/example_data.rb

    r214 r270  
    11module FixtureReplacement 
    22  attributes_for :user do |a| 
    3     login = String.random 
     3    username = String.random 
    44    password = String.random 
    55     
    6     a.login = login 
    7     a.email = "#{login}@example.com" 
     6    a.username = username 
     7    a.email = "#{username}@example.com" 
    88    a.password = password 
    99    a.password_confirmation = password 
  • incubator/jumpstart/db/migrate/001_create_users.rb

    r214 r270  
    22  def self.up 
    33    create_table :users, :force => true do |t| 
    4       t.string    :login 
     4      t.string    :username 
    55      t.string    :email 
    66      t.string    :crypted_password 
    77      t.string    :remember_token 
    88      t.datetime  :remember_token_expires_at 
    9       t.string    :activation_code 
    10       t.datetime  :activated_at 
     9      t.string    :identity_url 
    1110      t.timestamps 
    1211    end 
  • incubator/jumpstart/db/schema.rb

    r214 r270  
    1313 
    1414  create_table "users", :force => true do |t| 
    15     t.string   "login
     15    t.string   "username
    1616    t.string   "email" 
    1717    t.string   "crypted_password" 
    1818    t.string   "remember_token" 
    1919    t.datetime "remember_token_expires_at" 
    20     t.string   "activation_code" 
    21     t.datetime "activated_at" 
     20    t.string   "identity_url" 
    2221    t.datetime "created_at" 
    2322    t.datetime "updated_at" 
  • incubator/jumpstart/lib/acts_as_authentable.rb

    r214 r270  
    1212        end 
    1313 
    14         COLUMNS = { :login => :string, 
     14        COLUMNS = { :username => :string, 
    1515                    :email => :string, 
    1616                    :crypted_password => :string, 
    1717                    :remember_token => :string, 
    18                     :remember_token_expires_at => :datetime}.freeze 
     18                    :remember_token_expires_at => :datetime, 
     19                    :identity_url => :string}.freeze 
    1920 
    2021        def add_authentable_fields 
  • incubator/jumpstart/lib/authentable_entity.rb

    r269 r270  
    1111      attr_accessor :password 
    1212 
    13       validates_presence_of   :login 
    14       validates_length_of     :login, :within => 3..40 
    15       validates_uniqueness_of :login, :case_sensitive => false 
     13      validates_presence_of   :username 
     14      validates_length_of     :username, :within => 3..40 
     15      validates_uniqueness_of :username, :case_sensitive => false 
    1616 
    1717      validates_presence_of   :email 
     
    2828       
    2929      # Prevents users from submitting crafted forms that bypasses activation. 
    30       attr_accessible :login, :email, :password, :password_confirmation 
     30      attr_accessible :username, :email, :password, :password_confirmation 
    3131 
    3232      extend ClassMethods 
  • incubator/jumpstart/lib/authenticated_system.rb

    r214 r270  
    2929    #  # only allow nonbobs 
    3030    #  def authorized? 
    31     #    current_user.login != "bob" 
     31    #    current_user.username != "bob" 
    3232    #  end 
    3333    def authorized? 
  • incubator/jumpstart/test/fixtures/users.yml

    r214 r270  
    11quentin: 
    22  id: 1 
    3   login: quentin 
     3  username: quentin 
    44  email: quentin@example.com 
    55  crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test 
     
    1010aaron: 
    1111  id: 2 
    12   login: aaron 
     12  username: aaron 
    1313  email: aaron@example.com 
    1414  crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test 
  • incubator/jumpstart/test/test_helpers/authenticated_test_helper.rb

    r214 r270  
    99 
    1010  def authorize_as(user) 
    11     @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user).login, 'test') : nil 
     11    @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user).email, 'test') : nil 
    1212  end 
    1313end 
  • incubator/jumpstart/test/unit/user_test.rb

    r269 r270  
    33describe "User", ActiveSupport::TestCase do 
    44  describe "validations" do 
    5     it "should require a login" do 
    6       user = User.new(:login => nil) 
    7       user.should.have_errors(:login
     5    it "should require a username" do 
     6      user = User.new(:username => nil) 
     7      user.should.have_errors(:username
    88    end 
    99 
    10     it "should require a unique login" do 
    11       User.stubs(:find).returns(stub("another user with same login")) 
     10    it "should require a unique username" do 
     11      User.stubs(:find).returns(stub("another user with same username")) 
    1212       
    13       user = User.new(:login => 'foo') 
    14       user.should.have_errors(:login
     13      user = User.new(:username => 'foo') 
     14      user.should.have_errors(:username
    1515    end 
    1616