diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
new file mode 100644
index 0000000..e85b91e
--- /dev/null
+++ b/app/controllers/account_controller.rb
@@ -0,0 +1,43 @@
+class AccountController < ApplicationController
+ # Be sure to include AuthenticationSystem in Application Controller instead
+ include AuthenticatedSystem
+ # If you want "remember me" functionality, add this before_filter to Application Controller
+ before_filter :login_from_cookie
+
+ # say something nice, you goof! something sweet.
+ def index
+ redirect_to(:action => 'signup') unless logged_in? || User.count > 0
+ end
+
+ def login
+ return unless request.post?
+ self.current_user = User.authenticate(params[:login], params[:password])
+ if logged_in?
+ if params[:remember_me] == "1"
+ self.current_user.remember_me
+ cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
+ end
+ redirect_back_or_default(:controller => '/account', :action => 'index')
+ flash[:notice] = "Logged in successfully"
+ end
+ end
+
+ def signup
+ @user = User.new(params[:user])
+ return unless request.post?
+ @user.save!
+ self.current_user = @user
+ redirect_back_or_default(:controller => '/account', :action => 'index')
+ flash[:notice] = "Thanks for signing up!"
+ rescue ActiveRecord::RecordInvalid
+ render :action => 'signup'
+ end
+
+ def logout
+ self.current_user.forget_me if logged_in?
+ cookies.delete :auth_token
+ reset_session
+ flash[:notice] = "You have been logged out."
+ redirect_back_or_default(:controller => '/account', :action => 'index')
+ end
+end
diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb
new file mode 100644
index 0000000..1b63056
--- /dev/null
+++ b/app/helpers/account_helper.rb
@@ -0,0 +1,2 @@
+module AccountHelper
+end
\ No newline at end of file
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 0000000..a7905f1
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,64 @@
+require 'digest/sha1'
+class User < ActiveRecord::Base
+ # Virtual attribute for the unencrypted password
+ attr_accessor :password
+
+ validates_presence_of :login, :email
+ validates_presence_of :password, :if => :password_required?
+ validates_presence_of :password_confirmation, :if => :password_required?
+ validates_length_of :password, :within => 4..40, :if => :password_required?
+ validates_confirmation_of :password, :if => :password_required?
+ validates_length_of :login, :within => 3..40
+ validates_length_of :email, :within => 3..100
+ validates_uniqueness_of :login, :email, :case_sensitive => false
+ before_save :encrypt_password
+
+ # Authenticates a user by their login name and unencrypted password. Returns the user or nil.
+ def self.authenticate(login, password)
+ u = find_by_login(login) # need to get the salt
+ u && u.authenticated?(password) ? u : nil
+ end
+
+ # Encrypts some data with the salt.
+ def self.encrypt(password, salt)
+ Digest::SHA1.hexdigest("--#{salt}--#{password}--")
+ end
+
+ # Encrypts the password with the user salt
+ def encrypt(password)
+ self.class.encrypt(password, salt)
+ end
+
+ def authenticated?(password)
+ crypted_password == encrypt(password)
+ end
+
+ def remember_token?
+ remember_token_expires_at && Time.now.utc < remember_token_expires_at
+ end
+
+ # These create and unset the fields required for remembering users between browser closes
+ def remember_me
+ self.remember_token_expires_at = 2.weeks.from_now.utc
+ self.remember_token = encrypt("#{email}--#{remember_token_expires_at}")
+ save(false)
+ end
+
+ def forget_me
+ self.remember_token_expires_at = nil
+ self.remember_token = nil
+ save(false)
+ end
+
+ protected
+ # before filter
+ def encrypt_password
+ return if password.blank?
+ self.salt = Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--") if new_record?
+ self.crypted_password = encrypt(password)
+ end
+
+ def password_required?
+ crypted_password.blank? || !password.blank?
+ end
+end
diff --git a/app/views/account/index.rhtml b/app/views/account/index.rhtml
new file mode 100644
index 0000000..d600d59
--- /dev/null
+++ b/app/views/account/index.rhtml
@@ -0,0 +1,56 @@
+
In the Caboose.
+
+<% content_for 'poem' do -%>
+"Train delayed? and what's to say?"
+"Blocked by last night's snow they say."
+Seven hours or so to wait;
+Well, that's pleasant! but there's the freight.
+Depot loafing no one fancies,
+We'll try the caboose and take our chances.
+
+Cool this morning in Watertown,
+Somewhat frosty___mercury down;
+Enter caboose___roaring fire,
+With never an air-hole; heat so dire
+That we shrivel and pant; we are roasted through-
+Outside, thermometer thirty-two.
+
+We start with a jerk and suddenly stop.
+"What's broke?" says one; another "What's up?",
+"Oh, nothing," they answer, "That's our way:
+You must stand the jerking, sorry to say."
+We "stand it" with oft this painful thought:
+Are our heads on yet, or are they not?
+
+Comrades in misery___let me see;
+Girl like a statue opposite me;
+Back and forth the others jostle___
+She never winks, nor moves a muscle;
+See her, as she sits there now;
+She's "well balanced," anyhow.
+
+Woman in trouble, tearful eyes,
+Sits by the window, softly cries,
+Pity___for griefs we may not know,
+For breasts that ache, for tears that flow,
+Though we know not why. Her eyelids red
+Tell a sorrowful tale___some hope is dead.
+
+Man who follows the Golden Rule,
+And lends his papers___a pocket full,
+Has a blank book___once in a minute
+Has an idea, and writes it in it.
+Guess him? Yes, of course I can,
+He's a___well___a newspaper man.
+
+Blue-eyed fairy, wrapped in fur;
+Sweet young mother tending her.
+Fairy thinks it's "awful far,"
+Wants to get off this "naughty car."
+So do we, young golden-hair;
+All this crowd are with you there!
+<% end -%>
+
+<%= simple_format @content_for_poem %>
+
+
\ No newline at end of file
diff --git a/app/views/account/login.rhtml b/app/views/account/login.rhtml
new file mode 100644
index 0000000..a14ff99
--- /dev/null
+++ b/app/views/account/login.rhtml
@@ -0,0 +1,14 @@
+<% form_tag do -%>
+
+<%= text_field_tag 'login' %>
+
+
+<%= password_field_tag 'password' %>
+
+
+
+
<%= submit_tag 'Log in' %>
+<% end -%>
diff --git a/app/views/account/signup.rhtml b/app/views/account/signup.rhtml
new file mode 100644
index 0000000..c0012a7
--- /dev/null
+++ b/app/views/account/signup.rhtml
@@ -0,0 +1,16 @@
+<%= error_messages_for :user %>
+<% form_for :user do |f| -%>
+