openid_fu_generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/History.txt +4 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +48 -0
  4. data/README.txt +48 -0
  5. data/Rakefile +4 -0
  6. data/config/hoe.rb +72 -0
  7. data/config/requirements.rb +15 -0
  8. data/lib/openid_fu.rb +10 -0
  9. data/lib/openid_fu/association.rb +12 -0
  10. data/lib/openid_fu/controller_methods.rb +97 -0
  11. data/lib/openid_fu/nonce.rb +5 -0
  12. data/lib/openid_fu/openid_ar_store.rb +62 -0
  13. data/lib/openid_fu/openid_attribute_types.rb +79 -0
  14. data/lib/openid_fu/openid_ax_ext.rb +12 -0
  15. data/lib/openid_fu/openid_setting.rb +5 -0
  16. data/lib/openid_fu/version.rb +9 -0
  17. data/openid_fu_generator.rb +246 -0
  18. data/script/console +10 -0
  19. data/script/destroy +14 -0
  20. data/script/generate +14 -0
  21. data/script/txt2html +74 -0
  22. data/setup.rb +1585 -0
  23. data/tasks/deployment.rake +34 -0
  24. data/tasks/environment.rake +7 -0
  25. data/tasks/website.rake +17 -0
  26. data/templates/activation.html.erb +3 -0
  27. data/templates/authenticated_system.rb +155 -0
  28. data/templates/authenticated_test_helper.rb +94 -0
  29. data/templates/controller.rb +111 -0
  30. data/templates/fixtures.yml +15 -0
  31. data/templates/functional_test.rb +87 -0
  32. data/templates/helper.rb +2 -0
  33. data/templates/login.html.erb +20 -0
  34. data/templates/migration.rb +55 -0
  35. data/templates/model.rb +92 -0
  36. data/templates/model_controller.rb +30 -0
  37. data/templates/model_functional_test.rb +64 -0
  38. data/templates/model_helper.rb +2 -0
  39. data/templates/notifier.rb +25 -0
  40. data/templates/notifier_test.rb +31 -0
  41. data/templates/observer.rb +11 -0
  42. data/templates/open_id_form.html.erb +13 -0
  43. data/templates/restore_location.html.erb +30 -0
  44. data/templates/signup.html.erb +19 -0
  45. data/templates/signup_notification.html.erb +8 -0
  46. data/templates/unit_test.rb +94 -0
  47. data/test/test_helper.rb +4 -0
  48. data/test/test_openid_fu.rb +11 -0
  49. metadata +108 -0
@@ -0,0 +1,30 @@
1
+ <%% form_tag session[:return_to], :method => session[:return_to_method] do %>
2
+ <%% session[:stored_parameters].delete :controller %>
3
+ <%% session[:stored_parameters].delete :action %>
4
+ <%% session[:stored_parameters].delete :id %>
5
+ <%% session[:stored_parameters].delete :authenticity_token %>
6
+ <%%
7
+ to_input = proc{|key, value|
8
+ case value
9
+ when Hash
10
+ value.map{|k,v| to_input["#{key}[#{k}]", v]}.join('')
11
+ when Array
12
+ value.map{|v| to_input["#{key}[]", v]}.join('')
13
+ else hidden_field_tag key, value
14
+ end
15
+ }
16
+ %>
17
+ <%% session[:stored_parameters].each do |key, value| %>
18
+ <%%= to_input[key, value] %>
19
+ <%% end %>
20
+ <%% end %>
21
+
22
+ <%%= javascript_tag %{
23
+ (function(){
24
+ var onload = window.onload;
25
+ window.onload = function(){
26
+ document.getElementsByTagName('form')[0].submit();
27
+ if(onload) onload();
28
+ }
29
+ })();
30
+ } %>
@@ -0,0 +1,19 @@
1
+ <h2>Signup with OpenID</h2>
2
+
3
+ <%%= render :partial => "<%= controller_file_name %>/open_id_form" %>
4
+
5
+ <h2>or create a <%= class_name %> Profile</h2>
6
+
7
+ <%%= error_messages_for :<%= file_name %> %>
8
+ <%% form_for @<%= file_name %> do |f| -%>
9
+ <p><label for="email">Email</label><br/>
10
+ <%%= f.text_field :email %></p>
11
+
12
+ <p><label for="password">Password</label><br/>
13
+ <%%= f.password_field :password %></p>
14
+
15
+ <p><label for="password_confirmation">Confirm Password</label><br/>
16
+ <%%= f.password_field :password_confirmation %></p>
17
+
18
+ <p><%%= submit_tag 'Sign up' %></p>
19
+ <%% end -%>
@@ -0,0 +1,8 @@
1
+ Your account has been created.
2
+
3
+ Email: <%%= @<%= file_name %>.email %>
4
+ Password: <%%= @<%= file_name %>.password %>
5
+
6
+ Visit this url to activate your account:
7
+
8
+ <%%= @url %>
@@ -0,0 +1,94 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class <%= class_name %>Test < Test::Unit::TestCase
4
+ # Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead.
5
+ # Then, you can remove it from this and the functional test.
6
+ include AuthenticatedTestHelper
7
+ fixtures :<%= table_name %>
8
+
9
+ def test_should_create_<%= file_name %>
10
+ assert_difference "<%= class_name %>.count" do
11
+ <%= file_name %> = create_<%= file_name %>
12
+ assert !<%= file_name %>.new_record?, "#{<%= file_name %>.errors.full_messages.to_sentence}"
13
+ end
14
+ end
15
+
16
+ def test_should_require_password
17
+ assert_no_difference "<%= class_name %>.count" do
18
+ u = create_<%= file_name %>(:password => nil)
19
+ assert u.errors.on(:password)
20
+ end
21
+ end
22
+
23
+ def test_should_require_password_confirmation
24
+ assert_no_difference "<%= class_name %>.count" do
25
+ u = create_<%= file_name %>(:password_confirmation => nil)
26
+ assert u.errors.on(:password_confirmation)
27
+ end
28
+ end
29
+
30
+ def test_should_require_email
31
+ assert_no_difference "<%= class_name %>.count" do
32
+ u = create_<%= file_name %>(:email => nil)
33
+ assert u.errors.on(:email)
34
+ end
35
+ end
36
+
37
+ def test_should_reset_password
38
+ <%= table_name %>(:quentin).update_attributes(:password => 'new password', :password_confirmation => 'new password')
39
+ assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin@example.com', 'new password')
40
+ end
41
+
42
+ def test_should_not_rehash_password
43
+ <%= table_name %>(:quentin).update_attributes(:email => 'quentin2@example.com')
44
+ assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin2@example.com', 'test')
45
+ end
46
+
47
+ def test_should_authenticate_<%= file_name %>
48
+ assert_equal <%= table_name %>(:quentin), <%= class_name %>.authenticate('quentin@example.com', 'test')
49
+ end
50
+
51
+ def test_should_set_remember_token
52
+ <%= table_name %>(:quentin).remember_me
53
+ assert_not_nil <%= table_name %>(:quentin).remember_token
54
+ assert_not_nil <%= table_name %>(:quentin).remember_token_expires_at
55
+ end
56
+
57
+ def test_should_unset_remember_token
58
+ <%= table_name %>(:quentin).remember_me
59
+ assert_not_nil <%= table_name %>(:quentin).remember_token
60
+ <%= table_name %>(:quentin).forget_me
61
+ assert_nil <%= table_name %>(:quentin).remember_token
62
+ end
63
+
64
+ def test_should_remember_me_for_one_week
65
+ before = 1.week.from_now.utc
66
+ <%= table_name %>(:quentin).remember_me_for 1.week
67
+ after = 1.week.from_now.utc
68
+ assert_not_nil <%= table_name %>(:quentin).remember_token
69
+ assert_not_nil <%= table_name %>(:quentin).remember_token_expires_at
70
+ assert <%= table_name %>(:quentin).remember_token_expires_at.between?(before, after)
71
+ end
72
+
73
+ def test_should_remember_me_until_one_week
74
+ time = 1.week.from_now.utc
75
+ <%= table_name %>(:quentin).remember_me_until time
76
+ assert_not_nil <%= table_name %>(:quentin).remember_token
77
+ assert_not_nil <%= table_name %>(:quentin).remember_token_expires_at
78
+ assert_equal <%= table_name %>(:quentin).remember_token_expires_at, time
79
+ end
80
+
81
+ def test_should_remember_me_default_two_weeks
82
+ before = 2.weeks.from_now.utc
83
+ <%= table_name %>(:quentin).remember_me
84
+ after = 2.weeks.from_now.utc
85
+ assert_not_nil <%= table_name %>(:quentin).remember_token
86
+ assert_not_nil <%= table_name %>(:quentin).remember_token_expires_at
87
+ assert <%= table_name %>(:quentin).remember_token_expires_at.between?(before, after)
88
+ end
89
+
90
+ protected
91
+ def create_<%= file_name %>(options = {})
92
+ <%= class_name %>.create({ :nickname => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options))
93
+ end
94
+ end
@@ -0,0 +1,4 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require 'redgreen'
4
+ require File.dirname(__FILE__) + '/../lib/openid_fu'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestOpenidFu < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: openid_fu_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rakuto Furutani
8
+ - Genki Takiuchi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2008-05-19 00:00:00 +09:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: description of gem
18
+ email:
19
+ - rakuto@gmail.com
20
+ - genki@s21g.com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - History.txt
27
+ - License.txt
28
+ - Manifest.txt
29
+ - README.txt
30
+ files:
31
+ - History.txt
32
+ - License.txt
33
+ - Manifest.txt
34
+ - README.txt
35
+ - Rakefile
36
+ - openid_fu_generator.rb
37
+ - templates/activation.html.erb
38
+ - templates/authenticated_system.rb
39
+ - templates/authenticated_test_helper.rb
40
+ - templates/controller.rb
41
+ - templates/fixtures.yml
42
+ - templates/functional_test.rb
43
+ - templates/helper.rb
44
+ - templates/login.html.erb
45
+ - templates/migration.rb
46
+ - templates/model.rb
47
+ - templates/model_controller.rb
48
+ - templates/model_functional_test.rb
49
+ - templates/model_helper.rb
50
+ - templates/notifier.rb
51
+ - templates/notifier_test.rb
52
+ - templates/observer.rb
53
+ - templates/open_id_form.html.erb
54
+ - templates/restore_location.html.erb
55
+ - templates/signup.html.erb
56
+ - templates/signup_notification.html.erb
57
+ - templates/unit_test.rb
58
+ - config/hoe.rb
59
+ - config/requirements.rb
60
+ - lib/openid_fu.rb
61
+ - lib/openid_fu/version.rb
62
+ - lib/openid_fu/association.rb
63
+ - lib/openid_fu/controller_methods.rb
64
+ - lib/openid_fu/nonce.rb
65
+ - lib/openid_fu/openid_ar_store.rb
66
+ - lib/openid_fu/openid_attribute_types.rb
67
+ - lib/openid_fu/openid_ax_ext.rb
68
+ - lib/openid_fu/openid_setting.rb
69
+ - script/console
70
+ - script/destroy
71
+ - script/generate
72
+ - script/txt2html
73
+ - setup.rb
74
+ - tasks/deployment.rake
75
+ - tasks/environment.rake
76
+ - tasks/website.rake
77
+ - test/test_helper.rb
78
+ - test/test_openid_fu.rb
79
+ has_rdoc: true
80
+ homepage: http://openid-fu.rubyforge.org
81
+ post_install_message:
82
+ rdoc_options:
83
+ - --main
84
+ - README.txt
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: "0"
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ requirements: []
100
+
101
+ rubyforge_project: openid-fu
102
+ rubygems_version: 1.1.1
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: description of gem
106
+ test_files:
107
+ - test/test_helper.rb
108
+ - test/test_openid_fu.rb