teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

認証メールのURLにアクセスした際のログを追加

2020/04/23 23:32

投稿

yoangelo
yoangelo

スコア8

title CHANGED
File without changes
body CHANGED
@@ -79,6 +79,31 @@
79
79
  end
80
80
 
81
81
  ```
82
+ ```
83
+ #認証メールのURLにアクセスした際のログ
84
+ web_1 | Started GET "/users/confirmation?confirmation_token=URD69pQDCmxR9Q6Yog-a" for 172.19.0.1 at 2020-04-23 23:28:35 +0000
85
+ web_1 | Processing by Devise::ConfirmationsController#show as HTML
86
+ web_1 | Parameters: {"confirmation_token"=>"URD69pQDCmxR9Q6Yog-a"}
87
+ web_1 | User Load (0.9ms) SELECT `users`.* FROM `users` WHERE `users`.`confirmation_token` = 'URD69pQDCmxR9Q6Yog-a' ORDER BY `users`.`id` ASC LIMIT 1
88
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
89
+ web_1 | (0.8ms) BEGIN
90
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
91
+ web_1 | User Update (7.4ms) UPDATE `users` SET `confirmed_at` = '2020-04-23 23:28:35', `updated_at` = '2020-04-23 23:28:35' WHERE `users`.`id` = 49
92
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
93
+ web_1 | (4.3ms) COMMIT
94
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
95
+ web_1 | Redirected to http://localhost:3000/users/sign_in
96
+ web_1 | Completed 302 Found in 66ms (ActiveRecord: 13.3ms)
97
+ web_1 |
98
+ web_1 |
99
+ web_1 | Started GET "/users/sign_in" for 172.19.0.1 at 2020-04-23 23:28:35 +0000
100
+ web_1 | Processing by Devise::SessionsController#new as HTML
101
+ web_1 | Rendering devise/sessions/new.html.erb within layouts/application
102
+ web_1 | Rendered devise/shared/_links.html.erb (3.9ms)
103
+ web_1 | Rendered devise/sessions/new.html.erb within layouts/application (78.4ms)
104
+ web_1 | Rendered layouts/_header.html.erb (2.1ms)
105
+ web_1 | Completed 200 OK in 876ms (Views: 871.2ms | ActiveRecord: 0.0ms)
106
+ ```
82
107
  必要があれば、他のコードも追記します。
83
108
  # 開発環境
84
109
  Docker ver.3

1

application_controller.rb, confirmations_controller.rb のソースコードを追記

2020/04/23 23:32

投稿

yoangelo
yoangelo

スコア8

title CHANGED
File without changes
body CHANGED
@@ -46,6 +46,39 @@
46
46
  end
47
47
  end
48
48
  ```
49
+ ```ruby:
50
+ #confirmations_controller.rb
51
+ class Users::ConfirmationsController < Devise::ConfirmationsController
52
+ private
53
+ def after_confirmation_path_for(resource_name, resource)
54
+ sign_in(resource)
55
+ reviews_path
56
+ end
57
+ end
58
+ ```
59
+ ```ruby:
60
+ #application_controller.rb
61
+ class ApplicationController < ActionController::Base
62
+ protect_from_forgery with: :exception
63
+ before_action :configure_permitted_parameters, if: :devise_controller?
64
+
65
+ def after_sign_in_path_for(resource)
66
+ reviews_path
67
+ end
68
+
69
+ protected
70
+ def configure_permitted_parameters
71
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
72
+ devise_parameter_sanitizer.permit(:account_update, keys: [:username])
73
+ end
74
+
75
+ private
76
+ def sign_in_required
77
+ redirect_to new_user_session_url unless user_signed_in?
78
+ end
79
+ end
80
+
81
+ ```
49
82
  必要があれば、他のコードも追記します。
50
83
  # 開発環境
51
84
  Docker ver.3