salted_login_generator 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/templates/notify.rb CHANGED
@@ -1,56 +1,50 @@
1
- class Notify < ActionMailer::Base
2
- def signup(user, password='<what you entered on the website>', url=nil, sent_on=Time.now)
1
+ class <%= class_name %>Notify < ActionMailer::Base
2
+ def signup(<%= singular_name %>, password, url=nil)
3
+ setup_email(<%= singular_name %>)
4
+
3
5
  # Email header info
4
- @recipients = "#{user.email}"
5
- @from = CONFIG['email_from'].to_s
6
- @subject = "[#{CONFIG['app_name']}] Welcome to #{CONFIG['app_name']}!"
7
- @sent_on = sent_on
6
+ @subject += "Welcome to #{<%= class_name %>System::CONFIG[:app_name]}!"
8
7
 
9
8
  # Email body substitutions
10
- @body["name"] = "#{user.firstname} #{user.lastname}"
11
- @body["login"] = user.login
9
+ @body["name"] = "#{<%= singular_name %>.firstname} #{<%= singular_name %>.lastname}"
10
+ @body["login"] = <%= singular_name %>.login
12
11
  @body["password"] = password
13
- @body["url"] = url || CONFIG['app_url'].to_s
14
- @body["uuid"] = user.uuid
15
-
16
- if CONFIG['inject_mailer_error']
17
- raise "Signup mail failed"
18
- end
12
+ @body["url"] = url || <%= class_name %>System::CONFIG[:app_url].to_s
13
+ @body["app_name"] = <%= class_name %>System::CONFIG[:app_name].to_s
19
14
  end
20
15
 
21
- def forgot_password(user, password, url=nil, sent_on=Time.now)
16
+ def forgot_password(<%= singular_name %>, url=nil)
17
+ setup_email(<%= singular_name %>)
18
+
22
19
  # Email header info
23
- @recipients = "#{user.email}"
24
- @from = CONFIG['email_from'].to_s
25
- @subject = "[#{CONFIG['app_name']}] Welcome to #{CONFIG['app_name']}!"
26
- @sent_on = sent_on
20
+ @subject += "Forgotten password notification"
27
21
 
28
22
  # Email body substitutions
29
- @body["name"] = "#{user.firstname} #{user.lastname}"
30
- @body["login"] = user.login
31
- @body["password"] = password
32
- @body["url"] = url || CONFIG['app_url'].to_s
33
-
34
- if CONFIG['inject_mailer_error']
35
- raise "Forgot password mail failed"
36
- end
23
+ @body["name"] = "#{<%= singular_name %>.firstname} #{<%= singular_name %>.lastname}"
24
+ @body["login"] = <%= singular_name %>.login
25
+ @body["url"] = url || <%= class_name %>System::CONFIG[:app_url].to_s
26
+ @body["app_name"] = <%= class_name %>System::CONFIG[:app_name].to_s
37
27
  end
38
28
 
39
- def change_password(user, password, url=nil, sent_on=Time.now)
29
+ def change_password(<%= singular_name %>, password, url=nil)
30
+ setup_email(<%= singular_name %>)
31
+
40
32
  # Email header info
41
- @recipients = "#{user.email}"
42
- @from = CONFIG['email_from'].to_s
43
- @subject = "[#{CONFIG['app_name']}] Welcome to #{CONFIG['app_name']}!"
44
- @sent_on = sent_on
33
+ @subject += "Changed password notification"
45
34
 
46
35
  # Email body substitutions
47
- @body["name"] = "#{user.firstname} #{user.lastname}"
48
- @body["login"] = user.login
36
+ @body["name"] = "#{<%= singular_name %>.firstname} #{<%= singular_name %>.lastname}"
37
+ @body["login"] = <%= singular_name %>.login
49
38
  @body["password"] = password
50
- @body["url"] = url || CONFIG['app_url'].to_s
39
+ @body["url"] = url || <%= class_name %>System::CONFIG[:app_url].to_s
40
+ @body["app_name"] = <%= class_name %>System::CONFIG[:app_name].to_s
41
+ end
51
42
 
52
- if CONFIG['inject_mailer_error']
53
- raise "Change password mail failed"
54
- end
43
+ def setup_email(<%= singular_name %>)
44
+ @recipients = "#{<%= singular_name %>.email}"
45
+ @from = <%= class_name %>System::CONFIG[:email_from].to_s
46
+ @subject = "[#{<%= class_name %>System::CONFIG[:app_name]}] "
47
+ @sent_on = Time.now
48
+ @headers['Content-Type'] = "text/plain; charset=#{<%= class_name %>System::CONFIG[:mail_charset]}; format=flowed"
55
49
  end
56
50
  end
@@ -1,6 +1,6 @@
1
1
  Dear <%%= @name %>,
2
2
 
3
- At your request, logbook has changed your password. If it was not at your request, then you should be aware that someone has access to your account and requested this change.
3
+ At your request, <%%= @app_name %> has changed your password. If it was not at your request, then you should be aware that someone has access to your account and requested this change.
4
4
 
5
5
  Your new login credentials are:
6
6
 
@@ -1,11 +1,10 @@
1
1
  Dear <%%= @name %>,
2
2
 
3
- At your request, logbook has reset your password. If it was not at your request, then you should be aware that someone has entered your email address as theirs in the forgotten password section of logbook.
3
+ At your request, <%%= @app_name %> has sent you the following URL so that you may reset your password. If it was not at your request, then you should be aware that someone has entered your email address as theirs in the forgotten password section of <%%= @app_name %>.
4
4
 
5
- Your new login credentials are:
5
+ Please click on the following link to go to the change password page:
6
6
 
7
- login: <%%= @login %>
8
- password: <%%= @password %>
7
+ <a href="<%%= @url%>">Click me!</a>
9
8
 
10
9
  It's advisable for you to change your password as soon as you login. It's as simple as navigating to 'Preferences' and clicking on 'Change Password'.
11
10
 
@@ -7,6 +7,6 @@ Your login credentials are:
7
7
 
8
8
  Please click on the following link to confirm your registration:
9
9
 
10
- <a href="<%%= @url%>account/verify/<%%= @uuid %>">Click me!</a>
10
+ <a href="<%%= @url%>">Click me!</a>
11
11
 
12
- <%%= @url %>
12
+ <%%= @url %>
data/templates/user.rb CHANGED
@@ -1,57 +1,120 @@
1
1
  require 'digest/sha1'
2
2
 
3
+ ActiveRecord::Validations::ClassMethods.module_eval {
4
+ public
5
+ def validate_on_virtual(*methods, &block)
6
+ methods << block if block_given?
7
+ write_inheritable_set(:validate_on_virtual, methods)
8
+ end
9
+
10
+ private
11
+ def validation_method(on)
12
+ case on
13
+ when :save then :validate
14
+ when :create then :validate_on_create
15
+ when :update then :validate_on_update
16
+ when :virtual then :validate_on_virtual
17
+ end
18
+ end
19
+ }
20
+
3
21
  # this model expects a certain database layout and its based on the name/login pattern.
4
- class User < ActiveRecord::Base
22
+ class <%= class_name %> < ActiveRecord::Base
23
+
24
+ def initialize(attributes = nil)
25
+ super
26
+ @new_password = true
27
+ end
5
28
 
6
29
  def self.authenticate(login, pass)
7
30
  u = find_first(["login = ? AND verified = 1", login])
8
- if u.nil?
9
- return nil
10
- end
11
- find_first(["login = ? AND password = ? AND verified = 1", login, salted_password(u.salt, hashed(pass))])
31
+ return nil if u.nil?
32
+ find_first(["login = ? AND salted_password = ? AND verified = 1", login, salted_password(u.salt, hashed(pass))])
12
33
  end
13
34
 
14
- def change_password(pass)
15
- self.password_confirmation = self.password = pass
35
+ def self.authenticate_by_token(id, token)
36
+ u = find_first(["id = ? AND security_token = ?", id, token])
37
+ return nil if u.nil? or u.token_expired?
38
+ return nil if false == u.update_expiry
39
+ u
16
40
  end
17
-
18
- def makepass
19
- chars = ("a".."z").to_a + (1..9).to_a
20
- chars = chars.sort_by { rand }
21
- s = chars[0..7].to_s
41
+
42
+ def token_expired?
43
+ self.security_token and self.token_expiry and (Time.now > self.token_expiry)
22
44
  end
23
45
 
24
- def verify
25
- toggle("verified")
46
+ def update_expiry
47
+ write_attribute('token_expiry', [self.token_expiry, Time.at(Time.now.to_i + 600 * 1000)].min)
48
+ write_attribute('authenticated_by_token', true)
49
+ write_attribute("verified", 1)
26
50
  update_without_callbacks
27
51
  end
28
52
 
53
+ def generate_security_token
54
+ if self.security_token.nil? or self.token_expiry.nil? or
55
+ (Time.now.to_i + token_lifetime / 2) >= self.token_expiry.to_i
56
+ return new_security_token
57
+ else
58
+ return self.security_token
59
+ end
60
+ end
61
+
62
+ def change_password(pass, confirm = nil)
63
+ self.password = pass
64
+ self.password_confirmation = confirm.nil? ? pass : confirm
65
+ @new_password = true
66
+ end
67
+
68
+ def valid?
69
+ super
70
+ run_validations(:validate_on_virtual) if do_virtual_validations
71
+ errors.empty?
72
+ end
73
+
29
74
  protected
30
75
 
76
+ attr_accessor :password, :password_confirmation
77
+
78
+ def do_virtual_validations
79
+ @new_password
80
+ end
81
+
31
82
  def self.hashed(str)
32
83
  return Digest::SHA1.hexdigest("change-me--#{str}--")[0..39]
33
84
  end
34
85
 
35
- before_create :generate_uuid
36
- before_save :crypt_password
37
-
86
+ after_save '@new_password = false'
87
+ after_validation :crypt_password
38
88
  def crypt_password
39
- write_attribute("salt", self.class.hashed("salt-#{Time.now}"))
40
- write_attribute("password", self.class.salted_password(salt, self.class.hashed(password)))
89
+ if @new_password
90
+ write_attribute("salt", self.class.hashed("salt-#{Time.now}"))
91
+ write_attribute("salted_password", self.class.salted_password(salt, self.class.hashed(@password)))
92
+ end
93
+ end
94
+
95
+ def new_security_token
96
+ write_attribute('security_token', self.class.hashed(self.salted_password + Time.now.to_i.to_s + rand.to_s))
97
+ write_attribute('token_expiry', Time.at(Time.now.to_i + token_lifetime))
98
+ update_without_callbacks
99
+ return self.security_token
41
100
  end
42
101
 
43
- def generate_uuid
44
- self.uuid = self.class.hashed("uuid-#{Time.now}")
102
+ def token_lifetime
103
+ <%= class_name %>System::CONFIG[:security_token_life_hours] * 60 * 60
45
104
  end
46
105
 
47
106
  def self.salted_password(salt, hashed_password)
48
107
  hashed(salt + hashed_password)
49
108
  end
50
109
 
51
- validates_length_of :login, :within => 3..40
52
- validates_length_of :password, :within => 5..40
53
- validates_presence_of :login, :password, :password_confirmation
110
+ validates_presence_of :login, :on => :create
111
+ validates_length_of :login, :within => 3..40, :on => :create
54
112
  validates_uniqueness_of :login, :on => :create
55
113
  validates_uniqueness_of :email, :on => :create
56
- validates_confirmation_of :password
114
+
115
+ validates_presence_of :password, :on => :virtual
116
+ validates_confirmation_of :password, :on => :virtual
117
+ validates_length_of :password, { :minimum => 5, :on => :virtual }
118
+ validates_length_of :password, { :maximum => 40, :on => :virtual }
57
119
  end
120
+
@@ -0,0 +1,16 @@
1
+ CREATE TABLE users (
2
+ id <%= @pk %>,
3
+ login VARCHAR(80) NOT NULL,
4
+ salted_password VARCHAR(40) NOT NULL,
5
+ email VARCHAR(60) NOT NULL,
6
+ firstname VARCHAR(40) NOT NULL,
7
+ lastname VARCHAR(40) NOT NULL,
8
+ salt CHAR(40) NOT NULL,
9
+ verified INT default 0,
10
+ role VARCHAR(40) default NULL,
11
+ security_token CHAR(40) default NULL,
12
+ token_expiry <%= @datetime %> default NULL,
13
+ created_at <%= @datetime %> default NULL,
14
+ updated_at <%= @datetime %> default NULL,
15
+ logged_in_at <%= @datetime %> default NULL
16
+ ) <%= @options %>;
@@ -1,13 +1,13 @@
1
1
  require File.dirname(__FILE__) + '/../test_helper'
2
2
 
3
- class UserTest < Test::Unit::TestCase
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
4
 
5
- fixtures :users
5
+ fixtures :<%= plural_name %>
6
6
 
7
7
  def test_auth
8
8
 
9
- assert_equal @bob, User.authenticate("bob", "atest")
10
- assert_nil User.authenticate("nonbob", "atest")
9
+ assert_equal @bob, <%= class_name %>.authenticate("bob", "atest")
10
+ assert_nil <%= class_name %>.authenticate("nonbob", "atest")
11
11
 
12
12
  end
13
13
 
@@ -16,33 +16,33 @@ class UserTest < Test::Unit::TestCase
16
16
 
17
17
  @longbob.change_password("nonbobpasswd")
18
18
  @longbob.save
19
- assert_equal @longbob, User.authenticate("longbob", "nonbobpasswd")
20
- assert_nil User.authenticate("longbob", "alongtest")
19
+ assert_equal @longbob, <%= class_name %>.authenticate("longbob", "nonbobpasswd")
20
+ assert_nil <%= class_name %>.authenticate("longbob", "alongtest")
21
21
  @longbob.change_password("alongtest")
22
22
  @longbob.save
23
- assert_equal @longbob, User.authenticate("longbob", "alongtest")
24
- assert_nil User.authenticate("longbob", "nonbobpasswd")
23
+ assert_equal @longbob, <%= class_name %>.authenticate("longbob", "alongtest")
24
+ assert_nil <%= class_name %>.authenticate("longbob", "nonbobpasswd")
25
25
 
26
26
  end
27
27
 
28
28
  def test_disallowed_passwords
29
29
 
30
- u = User.new
30
+ u = <%= class_name %>.new
31
31
  u.login = "nonbob"
32
32
 
33
- u.password = u.password_confirmation = "tiny"
33
+ u.change_password("tiny")
34
34
  assert !u.save
35
35
  assert u.errors.invalid?('password')
36
36
 
37
- u.password = u.password_confirmation = "hugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehuge"
37
+ u.change_password("hugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehuge")
38
38
  assert !u.save
39
39
  assert u.errors.invalid?('password')
40
40
 
41
- u.password = u.password_confirmation = ""
41
+ u.change_password("")
42
42
  assert !u.save
43
43
  assert u.errors.invalid?('password')
44
44
 
45
- u.password = u.password_confirmation = "bobs_secure_password"
45
+ u.change_password("bobs_secure_password")
46
46
  assert u.save
47
47
  assert u.errors.empty?
48
48
 
@@ -50,8 +50,8 @@ class UserTest < Test::Unit::TestCase
50
50
 
51
51
  def test_bad_logins
52
52
 
53
- u = User.new
54
- u.password = u.password_confirmation = "bobs_secure_password"
53
+ u = <%= class_name %>.new
54
+ u.change_password("bobs_secure_password")
55
55
 
56
56
  u.login = "x"
57
57
  assert !u.save
@@ -73,17 +73,17 @@ class UserTest < Test::Unit::TestCase
73
73
 
74
74
 
75
75
  def test_collision
76
- u = User.new
77
- u.login = "existingbob"
78
- u.password = u.password_confirmation = "bobs_secure_password"
76
+ u = <%= class_name %>.new
77
+ u.login = "existingbob"
78
+ u.change_password("bobs_secure_password")
79
79
  assert !u.save
80
80
  end
81
81
 
82
82
 
83
83
  def test_create
84
- u = User.new
85
- u.login = "nonexistingbob"
86
- u.password = u.password_confirmation = "bobs_secure_password"
84
+ u = <%= class_name %>.new
85
+ u.login = "nonexistingbob"
86
+ u.change_password("bobs_secure_password")
87
87
 
88
88
  assert u.save
89
89
 
data/templates/users.yml CHANGED
@@ -3,7 +3,7 @@
3
3
  bob:
4
4
  id: 1000001
5
5
  login: bob
6
- password: ef94c16f6c124a4e84cc215c164767bfa25f6e92 # atest
6
+ salted_password: ef94c16f6c124a4e84cc215c164767bfa25f6e92 # atest
7
7
  salt: 7f8b036f9b647d46d22abdbfc8113f44a88f9889
8
8
  email: bob@test.com
9
9
  verified: 1
@@ -11,7 +11,7 @@ bob:
11
11
  existingbob:
12
12
  id: 1000002
13
13
  login: existingbob
14
- password: 99d6b680d4bfa81cbd383ffa0390bb03323a0b9a # atest
14
+ salted_password: 99d6b680d4bfa81cbd383ffa0390bb03323a0b9a # atest
15
15
  salt: fc76daa7bc4e4b7833375cf9deca38beee4c5581
16
16
  email: existingbob@test.com
17
17
  verified: 1
@@ -19,7 +19,7 @@ existingbob:
19
19
  longbob:
20
20
  id: 1000003
21
21
  login: longbob
22
- password: c841391e1d29100a4920de7a8fbb4b0fd180c6c0 # alongtest
22
+ salted_password: c841391e1d29100a4920de7a8fbb4b0fd180c6c0 # alongtest
23
23
  salt: c068e3671780f16898c0a8295ae8d82cc59713e2
24
24
  email: longbob@test.com
25
25
  verified: 1
@@ -1,35 +1,15 @@
1
- <%%= start_form_tag :action=> "change_password" %>
1
+ <div title="<%%= title_helper %>" class="form">
2
+ <%%= head_helper :error => true %>
2
3
 
3
- <div title="Change password" class="form">
4
- <h3>Change Password</h3>
5
- <%% if @flash['notice'] %>
6
- <div>
7
- <p><%%= @flash['notice'] %></p>
8
- </div>
9
- <%% end %>
10
- <%% if @flash['message'] %>
11
- <div id="ErrorExplanation">
12
- <h2><%%= @flash['message'] %></h2>
13
- </div>
14
- <%% end %>
15
- <%%= error_messages_for 'user' %><br/>
16
-
17
4
  <div class="form-padding">
18
- <p>
19
- Enter your new password in the fields below and click 'Change Password'
20
- to have a new password sent to your email inbox.
21
- </p>
22
- <label for="user_password">Choose password:</label><br/>
23
- <%%= password_field "user", "password", :size => 30, :value => "" %><br/>
24
- <label for="user_password_confirmation">Confirm password:</label><br/>
25
- <%%= password_field "user", "password_confirmation", :size => 30, :value => "" %><br/>
26
-
27
- <div class="button-bar">
28
- <%%= submit_tag "Change password" %>
29
- <%%= link_to 'Cancel', :action=> 'login' %>
30
- </div>
5
+ <%%= message_helper 'change' %>
6
+
7
+ <%%= start_form_tag_helper %>
8
+ <%%= render_partial 'password', :<%= singular_name %> => @<%= singular_name %>, :submit => false %>
9
+ <div class="button-bar">
10
+ <%%= button_helper 'change_password' %>
11
+ <%%= link_helper 'change_cancel_welcome', :action => 'welcome' %>
12
+ </div>
13
+ <%%= end_form_tag %>
31
14
  </div>
32
- </div>
33
-
34
- <%%= end_form_tag %>
35
-
15
+ </div>
@@ -0,0 +1,12 @@
1
+ <div title="<%%= title_helper %>" class="form">
2
+ <%%= head_helper :error => true %>
3
+
4
+ <%%= start_form_tag_helper %>
5
+ <%%= render_partial 'edit', :<%= singular_name %> => @<%= singular_name %>, :submit => true %>
6
+ <%%= end_form_tag %>
7
+ </br>
8
+ <%%= start_form_tag_helper %>
9
+ <%%= render_partial 'password', :submit => true %>
10
+ <%%= end_form_tag %>
11
+ </div>
12
+ </div>
@@ -1,32 +1,16 @@
1
- <%%= start_form_tag :action=> "forgot_password" %>
2
-
3
- <div title="Forgotten password" class="form">
4
- <h3>Forgotten Password</h3>
5
- <%% if @flash['notice'] %>
6
- <div>
7
- <p><%%= @flash['notice'] %></p>
8
- </div>
9
- <%% end %>
10
- <%% if @flash['message'] %>
11
- <div id="ErrorExplanation">
12
- <h2><%%= @flash['message'] %></h2>
13
- </div>
14
- <%% end %>
1
+ <div title="<%%= title_helper %>" class="form">
2
+ <%%= head_helper %>
15
3
 
16
4
  <div class="form-padding">
17
- <p>
18
- Enter your email address in the field below and click 'Reset Password'
19
- to have a new password sent to your email inbox.
20
- </p>
21
- <label for="user_email">Email:</label><br/>
22
- <%%= text_field "user", "email", :size => 30, :value => "" %><br/>
23
-
24
- <div class="button-bar">
25
- <%%= submit_tag "Reset password" %>
26
- <%%= link_to 'Cancel', :action=> 'login' %>
27
- </div>
28
- </div>
29
- </div>
5
+ <p><%%= message_helper 'forgot_reset' %></p>
30
6
 
31
- <%%= end_form_tag %>
7
+ <%%= start_form_tag_helper %>
8
+ <%%= form_input :text_field, "email", :size => 30 %><br/>
32
9
 
10
+ <div class="button-bar">
11
+ <%%= button_helper 'forgot_reset' %>
12
+ <%%= link_helper 'forgot_cancel_login', :action => 'login' %>
13
+ </div>
14
+ <%%= end_form_tag %>
15
+ </div>
16
+ </div>
@@ -1,31 +1,18 @@
1
- <%%= start_form_tag :action=> "login" %>
2
-
3
- <div title="Account login" class="form">
4
- <h3>Please login</h3>
5
- <%% if @flash['notice'] %>
6
- <div>
7
- <p><%%= @flash['notice'] %></p>
8
- </div>
9
- <%% end %>
10
- <%% if @flash['message'] %>
11
- <div id="ErrorExplanation">
12
- <h2><%%= @flash['message'] %></h2>
13
- </div>
14
- <%% end %>
1
+ <div title="<%%= title_helper %>" class="form">
2
+ <%%= head_helper %>
15
3
 
16
4
  <div class="form-padding">
17
- <label for="user_login">Login:</label><br/>
18
- <%%= text_field "user", "login", :size => 30 %><br/>
19
- <label for="user_password">Password:</label><br/>
20
- <%%= password_field "user", "password", :size => 30, :value => "" %><br/>
5
+ <%%= start_form_tag_helper %>
6
+ <table>
7
+ <%%= form_input :text_field, "login", :size => 30 %><br/>
8
+ <%%= form_input :password_field, "password", :size => 30 %><br/>
9
+ </table>
21
10
 
22
- <div class="button-bar">
23
- <%%= submit_tag "Login" %>
24
- <%%= link_to 'Register for an account', :action => 'signup' %> |
25
- <%%= link_to 'Forgot your password?', :action => 'forgot_password' %>
26
- </div>
11
+ <div class="button-bar">
12
+ <%%= button_helper 'login' %>
13
+ <%%= link_helper 'login_signup', :action => 'signup' %> |
14
+ <%%= link_helper 'login_forgot_password', :action => 'forgot_password' %> </div>
15
+ <%%= end_form_tag %>
27
16
  </div>
28
17
  </div>
29
-
30
- <%%= end_form_tag %>
31
-
18
+
@@ -1,10 +1,8 @@
1
+ <div title="<%%= title_helper %>" class="memo">
2
+ <%%= head_helper :notice => false, :message => false %>
1
3
 
2
- <div class="memo">
3
- <h3>Logoff</h3>
4
+ <p><%%= message_helper 'logged_off' %>
4
5
 
5
- <p>You are now logged out of the system...</p>
6
-
7
- <%%= link_to "&#171; login", :action=>"login"%>
8
-
6
+ <%%= link_helper 'logout_login', :action => 'login' %>
9
7
  </div>
10
8
 
@@ -1,27 +1,14 @@
1
- <%%= start_form_tag :action=> "signup" %>
1
+ <div title="<%%= title_helper %>" class="form">
2
+ <%%= head_helper :error => true %>
2
3
 
3
- <div title="Account signup" class="form">
4
- <h3>Signup</h3>
5
- <%% if @flash['message'] %>
6
- <div id="ErrorExplanation">
7
- <h2><%%= @flash['message'] %></h2>
8
- </div>
9
- <%% end %>
10
- <%%= error_messages_for 'user' %><br/>
11
-
12
4
  <div class="form-padding">
13
- <label for="user_login">Desired login:</label><br/>
14
- <%%= text_field "user", "login", :size => 30 %><br/>
15
- <label for="user_email">Email address:</label><br/>
16
- <%%= text_field "user", "email", :size => 30 %><br/>
17
- <label for="user_password">Choose password:</label><br/>
18
- <%%= password_field "user", "password", :size => 30, :value => "" %><br/>
19
- <label for="user_password_confirmation">Confirm password:</label><br/>
20
- <%%= password_field "user", "password_confirmation", :size => 30, :value => "" %><br/>
21
-
22
- <div class="button-bar">
23
- <%%= submit_tag "Signup" %>
24
- </div>
25
- <div>
26
- <%%= end_form_tag %>
27
-
5
+ <%%= start_form_tag_helper %>
6
+ <%%= render_partial 'edit', :<%= singular_name %> => @<%= singular_name %>, :submit => false %></br>
7
+ <%%= render_partial 'password', :submit => false %>
8
+
9
+ <div class="button-bar">
10
+ <%%= button_helper 'signup' %>
11
+ </div>
12
+ <%%= end_form_tag %>
13
+ </div>
14
+ </div>
@@ -1,13 +1,7 @@
1
-
2
- <div class="memo">
3
- <h3>Welcome</h3>
4
-
5
- <p>You are now logged into the system...</p>
6
- <p>
7
- Since you are here it's safe to assume the application never called store_location, otherwise
8
- you would have been redirected somewhere else after a successful login.
9
- </p>
10
-
11
- <%%= link_to "&#171; logout", :action=>"logout"%>
1
+ <div title="<%%= title_helper %>" class="memo">
2
+ <%%= head_helper :notice => false, :message => false %>
3
+ <p><%%= message_helper 'now_logged_in' %></p>
4
+ <p><%%= message_helper 'redirect' %></p>
12
5
 
6
+ <%%= link_helper 'welcome_logout', :action => 'logout' %>
13
7
  </div>