質問編集履歴

2

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

2020/04/23 23:32

投稿

yoangelo
yoangelo

スコア8

test CHANGED
File without changes
test CHANGED
@@ -160,6 +160,56 @@
160
160
 
161
161
  ```
162
162
 
163
+ ```
164
+
165
+ #認証メールのURLにアクセスした際のログ
166
+
167
+ web_1 | Started GET "/users/confirmation?confirmation_token=URD69pQDCmxR9Q6Yog-a" for 172.19.0.1 at 2020-04-23 23:28:35 +0000
168
+
169
+ web_1 | Processing by Devise::ConfirmationsController#show as HTML
170
+
171
+ web_1 | Parameters: {"confirmation_token"=>"URD69pQDCmxR9Q6Yog-a"}
172
+
173
+ web_1 | User Load (0.9ms) SELECT `users`.* FROM `users` WHERE `users`.`confirmation_token` = 'URD69pQDCmxR9Q6Yog-a' ORDER BY `users`.`id` ASC LIMIT 1
174
+
175
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
176
+
177
+ web_1 | (0.8ms) BEGIN
178
+
179
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
180
+
181
+ 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
182
+
183
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
184
+
185
+ web_1 | (4.3ms) COMMIT
186
+
187
+ web_1 | ↳ /usr/local/bundle/gems/activerecord-5.2.4.2/lib/active_record/log_subscriber.rb:98
188
+
189
+ web_1 | Redirected to http://localhost:3000/users/sign_in
190
+
191
+ web_1 | Completed 302 Found in 66ms (ActiveRecord: 13.3ms)
192
+
193
+ web_1 |
194
+
195
+ web_1 |
196
+
197
+ web_1 | Started GET "/users/sign_in" for 172.19.0.1 at 2020-04-23 23:28:35 +0000
198
+
199
+ web_1 | Processing by Devise::SessionsController#new as HTML
200
+
201
+ web_1 | Rendering devise/sessions/new.html.erb within layouts/application
202
+
203
+ web_1 | Rendered devise/shared/_links.html.erb (3.9ms)
204
+
205
+ web_1 | Rendered devise/sessions/new.html.erb within layouts/application (78.4ms)
206
+
207
+ web_1 | Rendered layouts/_header.html.erb (2.1ms)
208
+
209
+ web_1 | Completed 200 OK in 876ms (Views: 871.2ms | ActiveRecord: 0.0ms)
210
+
211
+ ```
212
+
163
213
  必要があれば、他のコードも追記します。
164
214
 
165
215
  # 開発環境

1

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

2020/04/23 23:32

投稿

yoangelo
yoangelo

スコア8

test CHANGED
File without changes
test CHANGED
@@ -94,6 +94,72 @@
94
94
 
95
95
  ```
96
96
 
97
+ ```ruby:
98
+
99
+ #confirmations_controller.rb
100
+
101
+ class Users::ConfirmationsController < Devise::ConfirmationsController
102
+
103
+ private
104
+
105
+ def after_confirmation_path_for(resource_name, resource)
106
+
107
+ sign_in(resource)
108
+
109
+ reviews_path
110
+
111
+ end
112
+
113
+ end
114
+
115
+ ```
116
+
117
+ ```ruby:
118
+
119
+ #application_controller.rb
120
+
121
+ class ApplicationController < ActionController::Base
122
+
123
+ protect_from_forgery with: :exception
124
+
125
+ before_action :configure_permitted_parameters, if: :devise_controller?
126
+
127
+
128
+
129
+ def after_sign_in_path_for(resource)
130
+
131
+ reviews_path
132
+
133
+ end
134
+
135
+
136
+
137
+ protected
138
+
139
+ def configure_permitted_parameters
140
+
141
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:username])
142
+
143
+ devise_parameter_sanitizer.permit(:account_update, keys: [:username])
144
+
145
+ end
146
+
147
+
148
+
149
+ private
150
+
151
+ def sign_in_required
152
+
153
+ redirect_to new_user_session_url unless user_signed_in?
154
+
155
+ end
156
+
157
+ end
158
+
159
+
160
+
161
+ ```
162
+
97
163
  必要があれば、他のコードも追記します。
98
164
 
99
165
  # 開発環境