multi_auth 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. data/README +36 -0
  2. data/app/controllers/application_controller.rb +11 -0
  3. data/app/controllers/auth/email_controller.rb +34 -0
  4. data/app/controllers/auth/open_id_controller.rb +43 -0
  5. data/app/controllers/auth_controller.rb +24 -0
  6. data/app/controllers/credentials/email_controller.rb +156 -0
  7. data/app/controllers/credentials/open_id_controller.rb +85 -0
  8. data/app/controllers/credentials_controller.rb +14 -0
  9. data/app/controllers/signup/email_controller.rb +132 -0
  10. data/app/controllers/signup/open_id_controller.rb +62 -0
  11. data/app/controllers/signup_controller.rb +8 -0
  12. data/app/helpers/application_helper.rb +5 -0
  13. data/app/models/activation_mailer.rb +114 -0
  14. data/app/models/email_credential.rb +89 -0
  15. data/app/models/email_credential_edit_form.rb +52 -0
  16. data/app/models/email_login_form.rb +24 -0
  17. data/app/models/email_password_edit_form.rb +36 -0
  18. data/app/models/open_id_credential.rb +33 -0
  19. data/app/models/open_id_login_form.rb +17 -0
  20. data/app/models/session.rb +19 -0
  21. data/app/models/user.rb +37 -0
  22. data/app/views/activation_mailer/complete_for_credential.erb +4 -0
  23. data/app/views/activation_mailer/complete_for_notice.erb +4 -0
  24. data/app/views/activation_mailer/complete_for_signup.erb +4 -0
  25. data/app/views/activation_mailer/request_for_credential.erb +11 -0
  26. data/app/views/activation_mailer/request_for_notice.erb +11 -0
  27. data/app/views/activation_mailer/request_for_signup.erb +11 -0
  28. data/app/views/auth/email/index.html.erb +90 -0
  29. data/app/views/auth/logged_in.html.erb +21 -0
  30. data/app/views/auth/logged_out.html.erb +21 -0
  31. data/app/views/auth/open_id/index.html.erb +16 -0
  32. data/app/views/credentials/email/activated.html.erb +4 -0
  33. data/app/views/credentials/email/activation.html.erb +15 -0
  34. data/app/views/credentials/email/created.html.erb +15 -0
  35. data/app/views/credentials/email/delete.html.erb +20 -0
  36. data/app/views/credentials/email/edit_password.html.erb +31 -0
  37. data/app/views/credentials/email/new.html.erb +36 -0
  38. data/app/views/credentials/index.html.erb +88 -0
  39. data/app/views/credentials/open_id/delete.html.erb +20 -0
  40. data/app/views/credentials/open_id/new.html.erb +26 -0
  41. data/app/views/signup/email/_progress.html.erb +14 -0
  42. data/app/views/signup/email/activated.html.erb +9 -0
  43. data/app/views/signup/email/activation.html.erb +27 -0
  44. data/app/views/signup/email/created.html.erb +14 -0
  45. data/app/views/signup/email/index.html.erb +34 -0
  46. data/app/views/signup/email/validated.html.erb +21 -0
  47. data/app/views/signup/index.html.erb +51 -0
  48. data/app/views/signup/open_id/authenticated.html.erb +15 -0
  49. data/app/views/signup/open_id/created.html.erb +6 -0
  50. data/app/views/signup/open_id/index.html.erb +16 -0
  51. data/config/boot.rb +110 -0
  52. data/config/database.yml +22 -0
  53. data/config/database.yml.sqlite3 +22 -0
  54. data/config/environment.rb +62 -0
  55. data/config/routes.rb +51 -0
  56. data/config/smtp.yml.example +8 -0
  57. data/db/development.sqlite3 +0 -0
  58. data/db/schema.rb +88 -0
  59. data/db/test.sqlite3 +0 -0
  60. data/lib/action_mailer_util.rb +15 -0
  61. data/lib/multi_auth.rb +64 -0
  62. data/lib/multi_auth_helper.rb +98 -0
  63. data/lib/notice_formatter.rb +106 -0
  64. data/lib/open_id_authentication/result.rb +12 -0
  65. data/lib/token_util.rb +18 -0
  66. data/public/404.html +92 -0
  67. data/public/422.html +91 -0
  68. data/public/500.html +92 -0
  69. data/public/503.html +92 -0
  70. data/public/favicon.ico +0 -0
  71. data/public/images/battery/cell.png +0 -0
  72. data/public/images/battery/level-green.png +0 -0
  73. data/public/images/battery/level-orange.png +0 -0
  74. data/public/images/battery/level-red.png +0 -0
  75. data/public/images/battery/level-yellow.png +0 -0
  76. data/public/images/battery/style.html +82 -0
  77. data/public/images/favicons/livedoor.png +0 -0
  78. data/public/images/favicons/mixi.png +0 -0
  79. data/public/images/favicons/yahoo.png +0 -0
  80. data/public/images/h1-back.png +0 -0
  81. data/public/images/icons/fam/add.png +0 -0
  82. data/public/images/icons/fam/bin.png +0 -0
  83. data/public/images/icons/fam/bomb.png +0 -0
  84. data/public/images/icons/fam/cog.png +0 -0
  85. data/public/images/icons/fam/delete.png +0 -0
  86. data/public/images/icons/fam/email-with-desc.png +0 -0
  87. data/public/images/icons/fam/email.png +0 -0
  88. data/public/images/icons/fam/feed.png +0 -0
  89. data/public/images/icons/fam/help.png +0 -0
  90. data/public/images/icons/fam/key-with-desc.png +0 -0
  91. data/public/images/icons/fam/key.png +0 -0
  92. data/public/images/icons/fam/lightning.png +0 -0
  93. data/public/images/icons/fam/plugin.png +0 -0
  94. data/public/images/icons/fam/stop.png +0 -0
  95. data/public/images/icons/fam/table_save.png +0 -0
  96. data/public/images/icons/fam/tick.png +0 -0
  97. data/public/images/icons/fam/user.png +0 -0
  98. data/public/images/icons/fam/vcard.png +0 -0
  99. data/public/images/icons/openid-with-desc.png +0 -0
  100. data/public/images/icons/openid.png +0 -0
  101. data/public/images/logo-back.png +0 -0
  102. data/public/images/logo.png +0 -0
  103. data/public/images/side-column-back.png +0 -0
  104. data/public/javascripts/application.js +2 -0
  105. data/public/javascripts/controls.js +963 -0
  106. data/public/javascripts/dragdrop.js +973 -0
  107. data/public/javascripts/effects.js +1128 -0
  108. data/public/javascripts/prototype.js +4320 -0
  109. data/public/robots.txt +5 -0
  110. data/public/stylesheets/application.css +365 -0
  111. data/public/stylesheets/auth.css +22 -0
  112. data/public/stylesheets/home.css +114 -0
  113. data/rails/init.rb +24 -0
  114. data/test/functional/auth/email_controller_test.rb +102 -0
  115. data/test/functional/auth/open_id_controller_test.rb +76 -0
  116. data/test/functional/auth_controller_test.rb +74 -0
  117. data/test/functional/credentials/email_controller_test.rb +488 -0
  118. data/test/functional/credentials/open_id_controller_test.rb +308 -0
  119. data/test/functional/credentials_controller_test.rb +49 -0
  120. data/test/functional/signup/email_controller_test.rb +369 -0
  121. data/test/functional/signup/open_id_controller_test.rb +44 -0
  122. data/test/functional/signup_controller_test.rb +17 -0
  123. data/test/performance/browsing_test.rb +9 -0
  124. data/test/test_helper.rb +82 -0
  125. data/test/unit/action_mailer_util_test.rb +63 -0
  126. data/test/unit/activation_mailer_test.rb +181 -0
  127. data/test/unit/email_credential_edit_form_test.rb +173 -0
  128. data/test/unit/email_credential_test.rb +324 -0
  129. data/test/unit/email_login_form_test.rb +76 -0
  130. data/test/unit/email_password_edit_form_test.rb +117 -0
  131. data/test/unit/helpers/auth_helper_test.rb +4 -0
  132. data/test/unit/helpers/credentials/email_helper_test.rb +4 -0
  133. data/test/unit/helpers/credentials/open_id_helper_test.rb +4 -0
  134. data/test/unit/helpers/credentials_helper_test.rb +4 -0
  135. data/test/unit/helpers/email_auth_helper_test.rb +4 -0
  136. data/test/unit/helpers/email_signup_helper_test.rb +4 -0
  137. data/test/unit/helpers/open_id_auth_helper_test.rb +4 -0
  138. data/test/unit/helpers/open_id_signup_helper_test.rb +4 -0
  139. data/test/unit/helpers/password_auth_helper_test.rb +4 -0
  140. data/test/unit/helpers/password_signup_helper_test.rb +4 -0
  141. data/test/unit/helpers/signup_helper_test.rb +4 -0
  142. data/test/unit/notice_formatter_test.rb +153 -0
  143. data/test/unit/open_id_credential_test.rb +108 -0
  144. data/test/unit/open_id_login_form_test.rb +57 -0
  145. data/test/unit/session_test.rb +53 -0
  146. data/test/unit/token_util_test.rb +51 -0
  147. data/test/unit/user_test.rb +177 -0
  148. metadata +220 -0
@@ -0,0 +1,20 @@
1
+
2
+ <%- @title = "メールログイン情報の削除" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
5
+ <%- @topic_path << [@title] -%>
6
+
7
+ <h1><%=h @title %></h1>
8
+
9
+ <div>削除します。よろしいですか?</div>
10
+
11
+ <table border="1">
12
+ <tr>
13
+ <th>メールアドレス</th>
14
+ <td><%=h @email_credential.email %></td>
15
+ </tr>
16
+ </table>
17
+
18
+ <%- form_tag(:action => "destroy") { -%>
19
+ <div><%= submit_tag("削除") %></div>
20
+ <%- } -%>
@@ -0,0 +1,31 @@
1
+
2
+ <%- @title = "パスワードの変更" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
5
+ <%- @topic_path << [@title] -%>
6
+
7
+ <h1><%=h @title %></h1>
8
+
9
+ <%- form_for(:edit_form, @edit_form, :url => {:action => "update_password"}) { |f| -%>
10
+ <table border="1">
11
+ <tr>
12
+ <th>メールアドレス</th>
13
+ <td><%=h @email_credential.email %></td>
14
+ </tr>
15
+ <tr>
16
+ <th><%= f.label(:password) %></th>
17
+ <td>
18
+ <div><%= f.password_field(:password, :size => 20) %></div>
19
+ <div><%= f.password_field(:password_confirmation, :size => 20) %></div>
20
+ <%= error_message_on(:edit_form, :password) %>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ <div><%= submit_tag("変更") %></div>
25
+ <%- } -%>
26
+
27
+ <%- unless production? -%>
28
+ <div class="debug">
29
+ <%= error_messages_for(:edit_form) %>
30
+ </div>
31
+ <%- end -%>
@@ -0,0 +1,36 @@
1
+
2
+ <%- @title = "メール認証情報の追加" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
5
+ <%- @topic_path << [@title] -%>
6
+
7
+ <h1><%=h @title %></h1>
8
+
9
+ <%- form_for(:edit_form, @edit_form, :url => {:action => "create"}) { |f| -%>
10
+ <table border="1">
11
+ <tr>
12
+ <th><%= f.label(:email) %></th>
13
+ <td>
14
+ <%= f.text_field(:email, :size => 30) %>
15
+ <%= error_message_on(:edit_form, :email) %>
16
+ <%= error_message_on(:email_credential, :email) %>
17
+ </td>
18
+ </tr>
19
+ <tr>
20
+ <th><%= f.label(:password) %></th>
21
+ <td>
22
+ <div><%= f.password_field(:password, :size => 20) %></div>
23
+ <div><%= f.password_field(:password_confirmation, :size => 20) %></div>
24
+ <%= error_message_on(:edit_form, :password) %>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ <div><%= submit_tag("追加") %></div>
29
+ <%- } -%>
30
+
31
+ <%- unless production? -%>
32
+ <div class="debug">
33
+ <%= error_messages_for(:edit_form) %>
34
+ <%= error_messages_for(:email_credential) %>
35
+ </div>
36
+ <%- end -%>
@@ -0,0 +1,88 @@
1
+
2
+ <%- @title = "ログイン設定" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << [@title] -%>
5
+
6
+ <h2>OpenID認証</h2>
7
+
8
+ <table class="list">
9
+ <thead>
10
+ <tr>
11
+ <th>登録日</th>
12
+ <th>最終ログイン日時</th>
13
+ <th>OpenID</th>
14
+ <th>&nbsp;</th>
15
+ </tr>
16
+ </thead>
17
+ <tfoot>
18
+ <tr>
19
+ <td colspan="4">
20
+ <%- can_add_open_id_credential = (@open_id_credentials.size < OpenIdCredential::MaximumRecordsPerUser) -%>
21
+ <%= link_to_if(can_add_open_id_credential, add_icon + h(" OpenID認証を追加する"), :controller => "credentials/open_id", :action => "new") %>
22
+ </td>
23
+ </tr>
24
+ </tfoot>
25
+ <tbody>
26
+ <%- if @open_id_credentials.empty? -%>
27
+ <tr>
28
+ <td colspan="4" style="padding: 1em;">
29
+ OpenID認証は、登録されていません。
30
+ </td>
31
+ </tr>
32
+ <%- else -%>
33
+ <%- @open_id_credentials.each_with_index { |open_id_credential, index| -%>
34
+ <tr class="<%= even_or_odd(index) %>">
35
+ <td><%=h yyyymmdd(open_id_credential.created_at) %></td>
36
+ <td><%=h yyyymmdd_hhmm(open_id_credential.loggedin_at) %></td>
37
+ <td style="font-family: monospace;"><%=h open_id_credential.identity_url %></td>
38
+ <td><%= link_to(delete_icon + h(" 削除"), :controller => "credentials/open_id", :action => "delete", :open_id_credential_id => open_id_credential.id) %></td>
39
+ </tr>
40
+ <%- } -%>
41
+ <%- end -%>
42
+ </tbody>
43
+ </table>
44
+
45
+ <h2>メールアドレス認証</h2>
46
+
47
+ <table class="list">
48
+ <thead>
49
+ <tr>
50
+ <th>登録日</th>
51
+ <th>最終ログイン日時</th>
52
+ <th>メールアドレス</th>
53
+ <th colspan="2">&nbsp;</th>
54
+ </tr>
55
+ </thead>
56
+ <tfoot>
57
+ <tr>
58
+ <td colspan="6">
59
+ <%- can_add_email_credential = (@email_credentials.size < EmailCredential::MaximumRecordsPerUser) -%>
60
+ <%= link_to_if(can_add_email_credential, add_icon + h(" メールアドレス認証を追加する"), :controller => "credentials/email", :action => "new") %>
61
+ </td>
62
+ </tr>
63
+ </tfoot>
64
+ <tbody>
65
+ <%- if @email_credentials.empty? -%>
66
+ <tr>
67
+ <td colspan="5" style="padding: 1em;">
68
+ メールアドレス認証は、登録されていません。
69
+ </td>
70
+ </tr>
71
+ <%- else -%>
72
+ <%- @email_credentials.each_with_index { |email_credential, index| -%>
73
+ <tr class="<%= even_or_odd(index) %>">
74
+ <td><%=h yyyymmdd(email_credential.created_at) %></td>
75
+ <td><%=h yyyymmdd_hhmm(email_credential.loggedin_at) %></td>
76
+ <td>
77
+ <div style="font-family: monospace;"><%= email_credential.email %></div>
78
+ <%- unless email_credential.activated? -%>
79
+ <div>アクティベーション待ち</div>
80
+ <%- end -%>
81
+ </td>
82
+ <td><%= link_to(icon16("icons/fam/key.png", "パスワード変更") + h(" パスワード変更"), :controller => "credentials/email", :action => "edit_password", :email_credential_id => email_credential.id) %></td>
83
+ <td><%= link_to(delete_icon + h(" 削除"), :controller => "credentials/email", :action => "delete", :email_credential_id => email_credential.id) %></td>
84
+ </tr>
85
+ <%- } -%>
86
+ <%- end -%>
87
+ </tbody>
88
+ </table>
@@ -0,0 +1,20 @@
1
+
2
+ <%- @title = "OpenIDログイン情報の削除" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
5
+ <%- @topic_path << [@title] -%>
6
+
7
+ <h1><%=h @title %></h1>
8
+
9
+ <div>削除します。よろしいですか?</div>
10
+
11
+ <table border="1">
12
+ <tr>
13
+ <th>OpenID</th>
14
+ <td><%=h @open_id_credential.identity_url %></td>
15
+ </tr>
16
+ </table>
17
+
18
+ <%- form_tag(:action => "destroy") { -%>
19
+ <div><%= submit_tag("削除") %></div>
20
+ <%- } -%>
@@ -0,0 +1,26 @@
1
+
2
+ <%- @title = "OpenID認証情報の追加" -%>
3
+ <%- @topic_path << ["トップ", root_path] -%>
4
+ <%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
5
+ <%- @topic_path << [@title] -%>
6
+
7
+ <h1><%=h @title %></h1>
8
+
9
+ <%- form_for(:login_form, @login_form, :url => {:action => "create"}) { |f| -%>
10
+ <table border="1">
11
+ <tr>
12
+ <th><%= f.label(:openid_url) %></th>
13
+ <td>
14
+ <%= f.text_field(:openid_url, :size => 30) %>
15
+ <%= error_message_on(:login_form, :openid_url) %>
16
+ </td>
17
+ </tr>
18
+ </table>
19
+ <div><%= submit_tag("追加") %></div>
20
+ <%- } -%>
21
+
22
+ <%- unless production? -%>
23
+ <div class="debug">
24
+ <%= error_messages_for(:login_form) %>
25
+ </div>
26
+ <%- end -%>
@@ -0,0 +1,14 @@
1
+
2
+ <%-
3
+ item = proc { |num, html|
4
+ %|<li class="#{step == num ? "active" : "inactive"}">| + html + %|</li>|
5
+ }
6
+ -%>
7
+
8
+ <ol id="email-signup-progress">
9
+ <%= item[1, "ログイン情報の入力"] %>
10
+ <%= item[2, "ログイン情報の確認"] %>
11
+ <%= item[3, "仮登録の完了"] %>
12
+ <%= item[4, "本登録の確認"] %>
13
+ <%= item[5, "本登録の完了"] %>
14
+ </ol>
@@ -0,0 +1,9 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>本登録完了</h1>
5
+
6
+ <%= render(:partial => "progress", :locals => {:step => 5}) %>
7
+
8
+ <div>登録が完了しました。</div>
9
+ <div><%= link_to(h("ログインする"), :controller => "auth/email") %></div>
@@ -0,0 +1,27 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>本登録確認</h1>
5
+
6
+ <%= render(:partial => "progress", :locals => {:step => 4}) %>
7
+
8
+ <%- if @credential -%>
9
+ <div>有効なアクティベーションキー</div>
10
+ <%- if @activated -%>
11
+ <div>アクティベート済み</div>
12
+ <%- else -%>
13
+ <div>未アクティベート</div>
14
+ <table border="1">
15
+ <tr>
16
+ <th>メールアドレス</th>
17
+ <td><%=h @credential.email %></td>
18
+ </tr>
19
+ </table>
20
+ <%- form_tag(:action => "activate") { -%>
21
+ <%= hidden_field_tag("activation_token", @credential.activation_token) %>
22
+ <%= submit_tag("本登録") %>
23
+ <%- } -%>
24
+ <%- end -%>
25
+ <%- else -%>
26
+ <div>無効なアクティベーションキー</div>
27
+ <%- end -%>
@@ -0,0 +1,14 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>仮登録完了</h1>
5
+
6
+ <%= render(:partial => "progress", :locals => {:step => 3}) %>
7
+
8
+ <%=h @signup_form.email %>宛にメールを送信しました。
9
+
10
+ <%- unless production? -%>
11
+ <div class="debug">
12
+ <%= link_to(h("アクティベーション"), :action => "activation", :activation_token => @credential.activation_token) %>
13
+ </div>
14
+ <%- end -%>
@@ -0,0 +1,34 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>メールアドレスによるサインアップ</h1>
5
+
6
+ <%= render(:partial => "progress", :locals => {:step => 1}) %>
7
+
8
+ <%- form_for(:signup_form, @signup_form, :url => {:action => "validate"}) { |f| -%>
9
+ <table border="1">
10
+ <tr>
11
+ <th><%= f.label(:email) %></th>
12
+ <td>
13
+ <%= f.text_field(:email, :size => 30) %>
14
+ <%= error_message_on(:signup_form, :email) %>
15
+ <%= error_message_on(:credential, :email) %>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <th><%= f.label(:password) %></th>
20
+ <td>
21
+ <div><%= f.password_field(:password, :size => 20) %></div>
22
+ <div><%= f.password_field(:password_confirmation, :size => 20) %></div>
23
+ <%= error_message_on(:signup_form, :password) %>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+ <div><%= submit_tag("確認画面へ") %></div>
28
+ <%- } -%>
29
+
30
+ <%- unless production? -%>
31
+ <div class="debug">
32
+ <%= error_messages_for(:signup_form) %>
33
+ </div>
34
+ <%- end -%>
@@ -0,0 +1,21 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>登録確認</h1>
5
+
6
+ <%= render(:partial => "progress", :locals => {:step => 2}) %>
7
+
8
+ <table border="1">
9
+ <tr>
10
+ <th>メールアドレス</th>
11
+ <td><%=h @signup_form.email %></td>
12
+ </tr>
13
+ <tr>
14
+ <th>パスワード</th>
15
+ <td><%=h @signup_form.masked_password %></td>
16
+ </tr>
17
+ </table>
18
+
19
+ <%- form_tag(:action => "create") { -%>
20
+ <div><%= submit_tag("登録") %></div>
21
+ <%- } -%>
@@ -0,0 +1,51 @@
1
+
2
+ <%- @title = "アカウント登録" -%>
3
+ <%- @enable_side_column = false -%>
4
+
5
+ <h1>さあ、<%= MultiAuth.application_name %>をはじめよう</h1>
6
+
7
+ <div><%= MultiAuth.application_name %>のアカウント登録はとても簡単!</div>
8
+
9
+ <div>
10
+ <div style="float: left; width: 45%; margin-right: 10px;">
11
+ <h2>OpenIDで登録!</h2>
12
+ <div>登録の流れ: OpenIDを入力 → OpenID認証 → 確認 → 登録完了!</div>
13
+ <%- form_tag(:controller => "signup/open_id", :action => "authenticate") { -%>
14
+ <table border="1">
15
+ <tr>
16
+ <th><%= label_tag("openid_url", "OpenID URL") %></th>
17
+ <td>
18
+ <%= text_field_tag("openid_url", @openid_url, :size => 20) %>
19
+ </td>
20
+ </tr>
21
+ </table>
22
+ <div><%= submit_tag("次へ") %></div>
23
+ <%- } -%>
24
+ </div>
25
+ <div style="float: left; width: 45%;">
26
+ <h2>メールアドレスで登録!</h2>
27
+ <div>登録の流れ: メールアドレスとパスワードを入力 → 確認 → 確認メール受信 → 確認 → 登録完了!</div>
28
+ <%- form_for(:signup_form, @signup_form, :url => {:controller => "signup/email", :action => "validate"}) { |f| -%>
29
+ <table border="1">
30
+ <tr>
31
+ <th><%= f.label(:email) %></th>
32
+ <td>
33
+ <%= f.text_field(:email, :size => 30) %>
34
+ <%= error_message_on(:signup_form, :email) %>
35
+ <%= error_message_on(:credential, :email) %>
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <th><%= f.label(:password) %></th>
40
+ <td>
41
+ <div><%= f.password_field(:password, :size => 20) %></div>
42
+ <div><%= f.password_field(:password_confirmation, :size => 20) %></div>
43
+ <%= error_message_on(:signup_form, :password) %>
44
+ </td>
45
+ </tr>
46
+ </table>
47
+ <div><%= submit_tag("確認画面へ") %></div>
48
+ <%- } -%>
49
+ </div>
50
+ <div style="clear: left;"></div>
51
+ </div>
@@ -0,0 +1,15 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>認証完了</h1>
5
+
6
+ <table border="1">
7
+ <tr>
8
+ <th>OpenID</th>
9
+ <td><%=h @identity_url %></td>
10
+ </tr>
11
+ </table>
12
+
13
+ <%- form_tag(:action => "create") { -%>
14
+ <div><%= submit_tag("登録") %></div>
15
+ <%- } -%>
@@ -0,0 +1,6 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>登録完了</h1>
5
+
6
+ <p><%= link_to('ログイン', :controller => "auth/open_id") %></p>
@@ -0,0 +1,16 @@
1
+
2
+ <%- @title = "サインアップ" -%>
3
+
4
+ <h1>サインアップ</h1>
5
+
6
+ <%- form_tag(:action => "authenticate") { -%>
7
+ <table border="1">
8
+ <tr>
9
+ <th><%= label_tag("openid_url", "OpenID URL") %></th>
10
+ <td>
11
+ <%= text_field_tag("openid_url", @openid_url, :size => 20) %>
12
+ </td>
13
+ </tr>
14
+ </table>
15
+ <div><%= submit_tag("次へ") %></div>
16
+ <%- } -%>
data/config/boot.rb ADDED
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
@@ -0,0 +1,62 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Be sure to restart your server when you modify this file
3
+
4
+ # Specifies gem version of Rails to use when vendor/rails is not present
5
+ RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
6
+
7
+ # Bootstrap the Rails environment, frameworks, and default configuration
8
+ require File.join(File.dirname(__FILE__), 'boot')
9
+
10
+ # NOTE: このファイルは Rails Engines として使用する場合は効果が無い
11
+ Rails::Initializer.run do |config|
12
+ # Settings in config/environments/* take precedence over those specified here.
13
+ # Application configuration should go into files in config/initializers
14
+ # -- all .rb files in that directory are automatically loaded.
15
+
16
+ # Add additional load paths for your own custom dirs
17
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
18
+
19
+ # Specify gems that this application depends on and have them installed with rake gems:install
20
+ # config.gem "bj"
21
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
22
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
23
+ # config.gem "aws-s3", :lib => "aws/s3"
24
+ #config.gem "mongrel"
25
+ #config.gem "nayutaya-webhook-dispatcher", :version => ">= 0.0.2", :lib => "webhook-dispatcher", :source => "http://gems.github.com"
26
+ #config.gem "mislav-will_paginate", :version => "> 2.3.2", :lib => "will_paginate", :source => "http://gems.github.com"
27
+ config.gem "ruby-openid", :lib => 'openid'
28
+ config.gem "okkez-open_id_authentication", :lib => 'open_id_authentication'
29
+ #config.gem "open_id_authentication"
30
+ config.gem "validates_email_format_of"
31
+ config.gem "locale", :version => ">= 2.0.4"
32
+ config.gem "locale_rails", :version => ">= 2.0.4"
33
+ config.gem "gettext", :version => ">= 2.0.4"
34
+ config.gem "gettext_activerecord", :version => ">= 2.0.4"
35
+ config.gem "gettext_rails", :version => ">= 2.0.4"
36
+ config.gem "nayutaya-active-form", :lib => "active_form"
37
+
38
+ # Only load the plugins named here, in the order given (default is alphabetical).
39
+ # :all can be used as a placeholder for all plugins not explicitly named
40
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
41
+
42
+ # Skip frameworks you're not going to use. To use Rails without a database,
43
+ # you must remove the Active Record framework.
44
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
45
+
46
+ # Activate observers that should always be running
47
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
48
+
49
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
50
+ # Run "rake -D time" for a list of tasks for finding time zone names.
51
+ # config.time_zone = 'UTC'
52
+
53
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
54
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
55
+ # config.i18n.default_locale = :de
56
+ #config.i18n.default_locale = :ja
57
+
58
+ #config.action_mailer.raise_delivery_errors = true
59
+ #config.action_mailer.delivery_method = :smtp
60
+ #config.action_mailer.smtp_settings = YAML.load_file(RAILS_ROOT + "/config/smtp.yml")
61
+
62
+ end