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/USAGE +20 -13
- data/salted_login_generator.rb +35 -16
- data/templates/README +78 -83
- data/templates/_view_edit.rhtml +14 -0
- data/templates/_view_password.rhtml +12 -0
- data/templates/controller.rb +118 -78
- data/templates/controller_test.rb +92 -81
- data/templates/create_db +7 -0
- data/templates/en.yaml +69 -0
- data/templates/helper.rb +122 -0
- data/templates/login_environment.rb +32 -0
- data/templates/login_system.rb +24 -10
- data/templates/mock_notify.rb +18 -0
- data/templates/mock_time.rb +17 -0
- data/templates/notify.rb +32 -38
- data/templates/notify_change_password.rhtml +1 -1
- data/templates/notify_forgot_password.rhtml +3 -4
- data/templates/notify_signup.rhtml +2 -2
- data/templates/user.rb +88 -25
- data/templates/user_model.erbsql +16 -0
- data/templates/user_test.rb +21 -21
- data/templates/users.yml +3 -3
- data/templates/view_change_password.rhtml +12 -32
- data/templates/view_edit.rhtml +12 -0
- data/templates/view_forgot_password.rhtml +12 -28
- data/templates/view_login.rhtml +13 -26
- data/templates/view_logout.rhtml +4 -6
- data/templates/view_signup.rhtml +12 -25
- data/templates/view_welcome.rhtml +5 -11
- metadata +11 -6
- data/templates/app-config-development.yml +0 -6
- data/templates/app-config-production.yml +0 -6
- data/templates/app-config-test.yml +0 -6
- data/templates/user_model.sql +0 -15
data/templates/notify.rb
CHANGED
@@ -1,56 +1,50 @@
|
|
1
|
-
class Notify < ActionMailer::Base
|
2
|
-
def signup(
|
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
|
-
@
|
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"] = "#{
|
11
|
-
@body["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[
|
14
|
-
@body["
|
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(
|
16
|
+
def forgot_password(<%= singular_name %>, url=nil)
|
17
|
+
setup_email(<%= singular_name %>)
|
18
|
+
|
22
19
|
# Email header info
|
23
|
-
@
|
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"] = "#{
|
30
|
-
@body["login"] =
|
31
|
-
@body["
|
32
|
-
@body["
|
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(
|
29
|
+
def change_password(<%= singular_name %>, password, url=nil)
|
30
|
+
setup_email(<%= singular_name %>)
|
31
|
+
|
40
32
|
# Email header info
|
41
|
-
@
|
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"] = "#{
|
48
|
-
@body["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[
|
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
|
-
|
53
|
-
|
54
|
-
|
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,
|
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,
|
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
|
-
|
5
|
+
Please click on the following link to go to the change password page:
|
6
6
|
|
7
|
-
|
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
|
|
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
|
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
|
-
|
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
|
15
|
-
|
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
|
19
|
-
|
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
|
25
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
86
|
+
after_save '@new_password = false'
|
87
|
+
after_validation :crypt_password
|
38
88
|
def crypt_password
|
39
|
-
|
40
|
-
|
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
|
44
|
-
|
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
|
-
|
52
|
-
validates_length_of :
|
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
|
-
|
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 %>;
|
data/templates/user_test.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class <%= class_name %>Test < Test::Unit::TestCase
|
4
4
|
|
5
|
-
fixtures
|
5
|
+
fixtures :<%= plural_name %>
|
6
6
|
|
7
7
|
def test_auth
|
8
8
|
|
9
|
-
assert_equal @bob,
|
10
|
-
assert_nil
|
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,
|
20
|
-
assert_nil
|
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,
|
24
|
-
assert_nil
|
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 =
|
30
|
+
u = <%= class_name %>.new
|
31
31
|
u.login = "nonbob"
|
32
32
|
|
33
|
-
u.
|
33
|
+
u.change_password("tiny")
|
34
34
|
assert !u.save
|
35
35
|
assert u.errors.invalid?('password')
|
36
36
|
|
37
|
-
u.
|
37
|
+
u.change_password("hugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehugehuge")
|
38
38
|
assert !u.save
|
39
39
|
assert u.errors.invalid?('password')
|
40
40
|
|
41
|
-
u.
|
41
|
+
u.change_password("")
|
42
42
|
assert !u.save
|
43
43
|
assert u.errors.invalid?('password')
|
44
44
|
|
45
|
-
u.
|
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 =
|
54
|
-
u.
|
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 =
|
77
|
-
u.login
|
78
|
-
u.
|
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 =
|
85
|
-
u.login
|
86
|
-
u.
|
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
|
-
|
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
|
-
|
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
|
-
|
22
|
+
salted_password: c841391e1d29100a4920de7a8fbb4b0fd180c6c0 # alongtest
|
23
23
|
salt: c068e3671780f16898c0a8295ae8d82cc59713e2
|
24
24
|
email: longbob@test.com
|
25
25
|
verified: 1
|
@@ -1,35 +1,15 @@
|
|
1
|
-
<%%=
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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
|
-
<%%=
|
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
|
-
<%%=
|
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>
|
data/templates/view_login.rhtml
CHANGED
@@ -1,31 +1,18 @@
|
|
1
|
-
<%%=
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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
|
+
|
data/templates/view_logout.rhtml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
+
<div title="<%%= title_helper %>" class="memo">
|
2
|
+
<%%= head_helper :notice => false, :message => false %>
|
1
3
|
|
2
|
-
<
|
3
|
-
<h3>Logoff</h3>
|
4
|
+
<p><%%= message_helper 'logged_off' %>
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
<%%= link_to "« login", :action=>"login"%>
|
8
|
-
|
6
|
+
<%%= link_helper 'logout_login', :action => 'login' %>
|
9
7
|
</div>
|
10
8
|
|
data/templates/view_signup.rhtml
CHANGED
@@ -1,27 +1,14 @@
|
|
1
|
-
<%%=
|
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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
<%%=
|
21
|
-
|
22
|
-
|
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
|
-
|
3
|
-
|
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 "« 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>
|