okkez-multi_auth 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/application_controller.rb +0 -1
- data/app/controllers/auth/open_id_controller.rb +1 -1
- data/app/controllers/auth_controller.rb +5 -0
- data/app/views/auth/email/index.html.erb +3 -3
- data/app/views/auth/index.html.erb +49 -0
- data/app/views/auth/open_id/index.html.erb +1 -1
- data/app/views/credentials/email/activation.html.erb +1 -1
- data/app/views/credentials/email/created.html.erb +0 -3
- data/app/views/credentials/email/delete.html.erb +1 -4
- data/app/views/credentials/email/edit_password.html.erb +1 -4
- data/app/views/credentials/email/new.html.erb +1 -4
- data/app/views/credentials/index.html.erb +0 -2
- data/app/views/credentials/open_id/delete.html.erb +17 -20
- data/app/views/credentials/open_id/new.html.erb +1 -4
- data/app/views/signup/email/activation.html.erb +1 -1
- data/app/views/signup/email/index.html.erb +1 -1
- data/app/views/signup/email/validated.html.erb +1 -1
- data/app/views/signup/index.html.erb +2 -2
- data/app/views/signup/open_id/authenticated.html.erb +1 -1
- data/app/views/signup/open_id/index.html.erb +1 -1
- data/db/development.sqlite3 +0 -0
- data/db/test.sqlite3 +0 -0
- data/lib/multi_auth/action_controller.rb +0 -2
- data/lib/multi_auth/active_record.rb +0 -2
- data/rails/init.rb +5 -0
- data/test/functional/auth_controller_test.rb +9 -1
- data/test/unit/multi_auth_public_assets_generator_test.rb +1 -1
- metadata +3 -2
@@ -3,7 +3,6 @@
|
|
3
3
|
class ApplicationController < ActionController::Base
|
4
4
|
helper :all # include all helpers, all the time
|
5
5
|
protect_from_forgery # See ActionController::RequestForgeryProtection for details
|
6
|
-
before_filter { |c| c.instance_eval { @topic_path = [] }; true }
|
7
6
|
|
8
7
|
GetText.locale = "ja"
|
9
8
|
init_gettext "multi_auth"
|
@@ -20,7 +20,7 @@ class Auth::OpenIdController < ApplicationController
|
|
20
20
|
@open_id_credential = OpenIdCredential.find_by_identity_url(identity_url)
|
21
21
|
if @open_id_credential
|
22
22
|
@open_id_credential.login!
|
23
|
-
session[:user_id] = @open_id_credential.
|
23
|
+
session[:user_id] = @open_id_credential.user_id
|
24
24
|
flash[:notice] = "ログインしました。"
|
25
25
|
redirect_to(root_path)
|
26
26
|
else
|
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
<div id="dialog">
|
64
64
|
<h1>ログイン</h1>
|
65
|
-
<%- form_for(:login_form, @login_form, :url => {:action => "login"})
|
65
|
+
<%- form_for(:login_form, @login_form, :url => {:action => "login"}) do |f| -%>
|
66
66
|
<table id="email-login">
|
67
67
|
<tr>
|
68
68
|
<th><%= f.label(:email) %></th>
|
@@ -79,8 +79,8 @@
|
|
79
79
|
</td>
|
80
80
|
</tr>
|
81
81
|
</table>
|
82
|
-
|
83
|
-
<%-
|
82
|
+
<%= submit_tag("ログイン") %>
|
83
|
+
<%- end -%>
|
84
84
|
</div>
|
85
85
|
|
86
86
|
<%- unless production? -%>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%- @title = "ログイン" -%>
|
2
|
+
<%- @enable_side_column = false -%>
|
3
|
+
|
4
|
+
<div id="dialog">
|
5
|
+
<h1>OpenID によるログイン</h1>
|
6
|
+
|
7
|
+
<%- form_tag(:controller => 'auth/open_id', :action => "login") do -%>
|
8
|
+
<table>
|
9
|
+
<tr>
|
10
|
+
<th><%= label_tag(:openid_url, "OpenID") %></th>
|
11
|
+
<td>
|
12
|
+
<%= text_field_tag(:openid_url, "", :size => 30) %>
|
13
|
+
</td>
|
14
|
+
</tr>
|
15
|
+
</table>
|
16
|
+
<div><%= submit_tag("ログイン") %></div>
|
17
|
+
<%- end -%>
|
18
|
+
|
19
|
+
<hr />
|
20
|
+
|
21
|
+
<h1>メールアドレスでログイン</h1>
|
22
|
+
<%- form_for(:login_form, @login_form, :url => { :controller => 'auth/email', :action => "login"}) do |f| -%>
|
23
|
+
<table id="email-login">
|
24
|
+
<tr>
|
25
|
+
<th><%= f.label(:email) %></th>
|
26
|
+
<td>
|
27
|
+
<%= f.text_field(:email, :size => 30) %>
|
28
|
+
<%= error_message_on(:login_form, :email) %>
|
29
|
+
</td>
|
30
|
+
</tr>
|
31
|
+
<tr>
|
32
|
+
<th><%= f.label(:password) %></th>
|
33
|
+
<td>
|
34
|
+
<%= f.password_field(:password, :size => 30) %>
|
35
|
+
<%= error_message_on(:login_form, :password) %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
</table>
|
39
|
+
<%= submit_tag("ログイン") %>
|
40
|
+
<%- end -%>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<%- unless production? -%>
|
45
|
+
<div class="debug">
|
46
|
+
<%= error_messages_for(:login_form) %>
|
47
|
+
</div>
|
48
|
+
<%- end -%>
|
49
|
+
|
@@ -1,14 +1,11 @@
|
|
1
1
|
|
2
2
|
<%- @title = "メールログイン情報の削除" -%>
|
3
|
-
<%- @topic_path << ["トップ", root_path] -%>
|
4
|
-
<%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
|
5
|
-
<%- @topic_path << [@title] -%>
|
6
3
|
|
7
4
|
<h1><%=h @title %></h1>
|
8
5
|
|
9
6
|
<div>削除します。よろしいですか?</div>
|
10
7
|
|
11
|
-
<table
|
8
|
+
<table>
|
12
9
|
<tr>
|
13
10
|
<th>メールアドレス</th>
|
14
11
|
<td><%=h @email_credential.email %></td>
|
@@ -1,13 +1,10 @@
|
|
1
1
|
|
2
2
|
<%- @title = "パスワードの変更" -%>
|
3
|
-
<%- @topic_path << ["トップ", root_path] -%>
|
4
|
-
<%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
|
5
|
-
<%- @topic_path << [@title] -%>
|
6
3
|
|
7
4
|
<h1><%=h @title %></h1>
|
8
5
|
|
9
6
|
<%- form_for(:edit_form, @edit_form, :url => {:action => "update_password"}) { |f| -%>
|
10
|
-
<table
|
7
|
+
<table>
|
11
8
|
<tr>
|
12
9
|
<th>メールアドレス</th>
|
13
10
|
<td><%=h @email_credential.email %></td>
|
@@ -1,13 +1,10 @@
|
|
1
1
|
|
2
2
|
<%- @title = "メール認証情報の追加" -%>
|
3
|
-
<%- @topic_path << ["トップ", root_path] -%>
|
4
|
-
<%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
|
5
|
-
<%- @topic_path << [@title] -%>
|
6
3
|
|
7
4
|
<h1><%=h @title %></h1>
|
8
5
|
|
9
6
|
<%- form_for(:edit_form, @edit_form, :url => {:action => "create"}) { |f| -%>
|
10
|
-
<table
|
7
|
+
<table>
|
11
8
|
<tr>
|
12
9
|
<th><%= f.label(:email) %></th>
|
13
10
|
<td>
|
@@ -1,20 +1,17 @@
|
|
1
|
-
|
2
|
-
<%- @title = "OpenIDログイン情報の削除" -%>
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<
|
10
|
-
|
11
|
-
<
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
<%- form_tag(:action => "destroy") { -%>
|
19
|
-
<div><%= submit_tag("削除") %></div>
|
20
|
-
<%- } -%>
|
1
|
+
|
2
|
+
<%- @title = "OpenIDログイン情報の削除" -%>
|
3
|
+
|
4
|
+
<h1><%=h @title %></h1>
|
5
|
+
|
6
|
+
<div>削除します。よろしいですか?</div>
|
7
|
+
|
8
|
+
<table>
|
9
|
+
<tr>
|
10
|
+
<th>OpenID</th>
|
11
|
+
<td><%=h @open_id_credential.identity_url %></td>
|
12
|
+
</tr>
|
13
|
+
</table>
|
14
|
+
|
15
|
+
<%- form_tag(:action => "destroy") { -%>
|
16
|
+
<div><%= submit_tag("削除") %></div>
|
17
|
+
<%- } -%>
|
@@ -1,13 +1,10 @@
|
|
1
1
|
|
2
2
|
<%- @title = "OpenID認証情報の追加" -%>
|
3
|
-
<%- @topic_path << ["トップ", root_path] -%>
|
4
|
-
<%- @topic_path << ["ログイン設定", url_for(:controller => "/credentials")] -%>
|
5
|
-
<%- @topic_path << [@title] -%>
|
6
3
|
|
7
4
|
<h1><%=h @title %></h1>
|
8
5
|
|
9
6
|
<%- form_for(:login_form, @login_form, :url => {:action => "create"}) { |f| -%>
|
10
|
-
<table
|
7
|
+
<table>
|
11
8
|
<tr>
|
12
9
|
<th><%= f.label(:openid_url) %></th>
|
13
10
|
<td>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<h2>OpenIDで登録!</h2>
|
12
12
|
<div>登録の流れ: OpenIDを入力 → OpenID認証 → 確認 → 登録完了!</div>
|
13
13
|
<%- form_tag(:controller => "signup/open_id", :action => "authenticate") { -%>
|
14
|
-
<table
|
14
|
+
<table>
|
15
15
|
<tr>
|
16
16
|
<th><%= label_tag("openid_url", "OpenID URL") %></th>
|
17
17
|
<td>
|
@@ -26,7 +26,7 @@
|
|
26
26
|
<h2>メールアドレスで登録!</h2>
|
27
27
|
<div>登録の流れ: メールアドレスとパスワードを入力 → 確認 → 確認メール受信 → 確認 → 登録完了!</div>
|
28
28
|
<%- form_for(:signup_form, @signup_form, :url => {:controller => "signup/email", :action => "validate"}) { |f| -%>
|
29
|
-
<table
|
29
|
+
<table>
|
30
30
|
<tr>
|
31
31
|
<th><%= f.label(:email) %></th>
|
32
32
|
<td>
|
data/db/development.sqlite3
CHANGED
Binary file
|
data/db/test.sqlite3
CHANGED
Binary file
|
data/rails/init.rb
CHANGED
@@ -28,3 +28,8 @@ config.action_mailer.raise_delivery_errors = true
|
|
28
28
|
config.action_mailer.delivery_method = :smtp
|
29
29
|
config.action_mailer.smtp_settings = YAML.load_file(Rails.root + "config/smtp.yml")
|
30
30
|
|
31
|
+
config.to_prepare do
|
32
|
+
ActiveRecord::Base.__send__(:extend, MultiAuth::ActiveRecord::ClassMethods)
|
33
|
+
ActionController::Base.__send__(:extend, MultiAuth::ActionController::ClassMethods)
|
34
|
+
ActionController::Base.__send__(:include, MultiAuth::ActionController::InstanceMethods)
|
35
|
+
end
|
@@ -5,11 +5,19 @@ class AuthControllerTest < ActionController::TestCase
|
|
5
5
|
test "routes" do
|
6
6
|
base = {:controller => "auth"}
|
7
7
|
|
8
|
+
assert_routing("/auth", base.merge(:action => "index"))
|
8
9
|
assert_routing("/auth/logged_in", base.merge(:action => "logged_in"))
|
9
|
-
assert_routing("/auth/logout",
|
10
|
+
assert_routing("/auth/logout", base.merge(:action => "logout"))
|
10
11
|
assert_routing("/auth/logged_out", base.merge(:action => "logged_out"))
|
11
12
|
end
|
12
13
|
|
14
|
+
test "GET index" do
|
15
|
+
get :index
|
16
|
+
|
17
|
+
assert_response(:success)
|
18
|
+
assert_template("index")
|
19
|
+
end
|
20
|
+
|
13
21
|
test "GET logged_in" do
|
14
22
|
return_path = "/return"
|
15
23
|
|
@@ -9,7 +9,7 @@ class MultiAuthPublicAssetsGeneratorTest < Test::Unit::TestCase
|
|
9
9
|
@dest = File.expand_path(File.join(File.dirname(__FILE__), '../..', 'lib', 'generators'))
|
10
10
|
FileUtils.ln_s(@src, @dest)
|
11
11
|
FileUtils.mkdir_p(fake_rails_root)
|
12
|
-
@original_files =
|
12
|
+
@original_files = Dir.glob(File.join(fake_rails_root, '**/*'))
|
13
13
|
end
|
14
14
|
|
15
15
|
def teardown
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okkez-multi_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- okkez
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-16 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- app/views/credentials/email/created.html.erb
|
72
72
|
- app/views/credentials/email/activation.html.erb
|
73
73
|
- app/views/auth/logged_out.html.erb
|
74
|
+
- app/views/auth/index.html.erb
|
74
75
|
- app/views/auth/open_id/index.html.erb
|
75
76
|
- app/views/auth/email/index.html.erb
|
76
77
|
- app/views/auth/logged_in.html.erb
|