質問編集履歴
4
タイトルをポイントだけに絞りました。試したことに追記しました。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
パスワード再設定のurlが、Password Rsetフォームにリンクしないで、Homeへいくのですが・・。
|
test
CHANGED
@@ -4,15 +4,17 @@
|
|
4
4
|
|
5
5
|
root_url(トップページ)に戻ってしまいます。
|
6
6
|
|
7
|
-
Reset passwordのページに行きません。というより、コードはもちろん記述済みなのですが、この再設定のフォームに繋が
|
7
|
+
Reset passwordのページに行きません。というより、コードはもちろん記述済みなのですが、この再設定のフォームに繋がらずloop状態です。
|
8
8
|
|
9
9
|
Forgot passwordのフォームは問題なく現れます。
|
10
10
|
|
11
11
|
いろんなサイトを同様の事例が無いか探してみたり、チュートリアルページを何度も見直してみたのですがコードの記述に問題がなく
|
12
12
|
|
13
|
-
何がどうなっているのかわからない状態で
|
13
|
+
何がどうなっているのかわからない状態で1週間たってしまいました・・。
|
14
|
-
|
14
|
+
|
15
|
-
|
15
|
+
一人では解決できず困っております。アドバイス頂けますと大変有難いです。
|
16
|
+
|
17
|
+
よろしくお願いします。
|
16
18
|
|
17
19
|
|
18
20
|
|
@@ -26,7 +28,7 @@
|
|
26
28
|
|
27
29
|
ローカルで、パスワード再設定フォームからアドレスを入れるとサーバーに再設定フォーム用アドレスが生成されるはずが、
|
28
30
|
|
29
|
-
root_urlになってしまい、
|
31
|
+
root_urlになってしまい、ループ状態でReset Passwordフォームに繋がりません。
|
30
32
|
|
31
33
|
```
|
32
34
|
|
@@ -38,266 +40,226 @@
|
|
38
40
|
|
39
41
|
```ここに言語名を入力
|
40
42
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
S
|
58
|
-
|
59
|
-
Password
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
P
|
43
|
+
```
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
### 試したこと
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
Forgot passwordメールを送って出てきたサーバーログが以下なのですが、Homeのアドレスに必ずなってしまっていて、Reset passwordの
|
52
|
+
|
53
|
+
フォームに繋がりません。いろいろ探したコードチェックもしたのですが、何も落ち度がないのですが、なぜこんな現象が起こるのでしょうか・・。
|
54
|
+
|
55
|
+
11章の内容をgit mergeした際に一部コンフリクトを起こしたので、bit cleanをしたのですが、これが影響しているのでしょうか。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
Started POST "/password_resets" for 127.0.0.1 at 2020-02-03 23:17:51 +0900
|
60
|
+
|
61
|
+
Processing by PasswordResetsController#create as HTML
|
62
|
+
|
63
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"yD6fC+Ioj+4xoHm3hRKD7YcIyMvCvqgz0WtGPzd76Anx19rsWE6TFbOp1SdzIPN325rLS+dH/1xmiDbi19Ce2A==", "password_reset"=>"[FILTERED]", "commit"=>"Submit"}
|
64
|
+
|
65
|
+
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "***.***@gmail.com"], ["LIMIT", 1]]
|
66
|
+
|
67
|
+
SQL (16.0ms) UPDATE "users" SET "reset_digest" = '$2a$10$mP0rEY3TVbBo90YHyoms5eKR3DrmsSVCd4AwPEKpCfY6YgTWYkgty', "reset_sent_at" = '2020-02-03 14:17:51.087040' WHERE "users"."id" = ? [["id", 102]]
|
68
|
+
|
69
|
+
Rendering user_mailer/password_reset.html.erb within layouts/mailer
|
70
|
+
|
71
|
+
Rendered user_mailer/password_reset.html.erb within layouts/mailer (1.0ms)
|
72
|
+
|
73
|
+
Rendering user_mailer/password_reset.text.erb within layouts/mailer
|
74
|
+
|
75
|
+
Rendered user_mailer/password_reset.text.erb within layouts/mailer (0.0ms)
|
76
|
+
|
77
|
+
UserMailer#password_reset: processed outbound mail in 288.0ms
|
78
|
+
|
79
|
+
Sent mail to ***.***@gmail.com (2.0ms)
|
80
|
+
|
81
|
+
Date: Mon, 03 Feb 2020 23:17:51 +0900
|
82
|
+
|
83
|
+
From: noreply@example.com
|
84
|
+
|
85
|
+
To: ***.***@gmail.com
|
86
|
+
|
87
|
+
Message-ID: <5e382b8f62a73_2fb830046fc3623@DESKTOP-NGDL1L7.mail>
|
88
|
+
|
89
|
+
Subject: Password reset
|
90
|
+
|
91
|
+
Mime-Version: 1.0
|
92
|
+
|
93
|
+
Content-Type: multipart/alternative;
|
94
|
+
|
95
|
+
boundary="--==_mimepart_5e382b8f62294_2fb830046fc3528";
|
96
|
+
|
97
|
+
charset=UTF-8
|
98
|
+
|
99
|
+
Content-Transfer-Encoding: 7bit
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
106
|
+
|
107
|
+
Content-Type: text/plain;
|
108
|
+
|
109
|
+
charset=UTF-8
|
110
|
+
|
111
|
+
Content-Transfer-Encoding: 7bit
|
112
|
+
|
113
|
+
|
66
114
|
|
67
115
|
To reset your password click the link below:
|
68
116
|
|
69
117
|
|
70
118
|
|
71
|
-
|
119
|
+
http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com
|
120
|
+
|
121
|
+
|
72
122
|
|
73
123
|
This link will expire in two hours.
|
74
124
|
|
75
125
|
|
76
126
|
|
77
|
-
If you did not request your password to be reset, please ignore this email and
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
127
|
+
If you did not request your password to be reset, please ignore this email and
|
128
|
+
|
129
|
+
your password will stay as it is.
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
136
|
+
|
137
|
+
Content-Type: text/html;
|
138
|
+
|
139
|
+
charset=UTF-8
|
140
|
+
|
141
|
+
Content-Transfer-Encoding: 7bit
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
<!DOCTYPE html>
|
146
|
+
|
147
|
+
<html>
|
148
|
+
|
149
|
+
<head>
|
150
|
+
|
151
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
152
|
+
|
153
|
+
<style>
|
154
|
+
|
155
|
+
/* Email styles need to be inline */
|
156
|
+
|
157
|
+
</style>
|
158
|
+
|
159
|
+
</head>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<body>
|
164
|
+
|
165
|
+
<h1>Password reset</h1>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<p>To reset your password click the link below:</p>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<a href="http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com">Reset password</a>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<p>This link will expire in two hours.</p>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<p>
|
182
|
+
|
183
|
+
If you did not request your password to be reset, please ignore this email and
|
184
|
+
|
185
|
+
your password will stay as it is.
|
186
|
+
|
187
|
+
</p>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</body>
|
192
|
+
|
193
|
+
</html>
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528--
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
Redirected to http://localhost:3000/
|
202
|
+
|
203
|
+
Completed 302 Found in 376ms (ActiveRecord: 16.0ms)
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
Started GET "/" for 127.0.0.1 at 2020-02-03 23:17:51 +0900
|
210
|
+
|
211
|
+
Processing by StaticPagesController#home as HTML
|
212
|
+
|
213
|
+
Rendering static_pages/home.html.erb within layouts/application
|
214
|
+
|
215
|
+
Rendered static_pages/home.html.erb within layouts/application (3.0ms)
|
216
|
+
|
217
|
+
Rendered layouts/_head.html.erb (111.0ms)
|
218
|
+
|
219
|
+
Rendered layouts/_shim.html.erb (1.0ms)
|
220
|
+
|
221
|
+
Rendered layouts/_header.html.erb (1.0ms)
|
222
|
+
|
223
|
+
Rendered layouts/_footer.html.erb (0.0ms)
|
224
|
+
|
225
|
+
Completed 200 OK in 292ms (Views: 272.0ms | ActiveRecord: 0.0ms)
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
Started GET "/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=satoshi.taenaka%40gmail.com" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
232
|
+
|
233
|
+
Processing by PasswordResetsController#edit as HTML
|
234
|
+
|
235
|
+
Parameters: {"email"=>"***.***@gmail.com", "id"=>"-6kcTNIBrZspHPPJn5Aoxw"}
|
102
236
|
|
103
237
|
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "***.***@gmail.com"], ["LIMIT", 1]]
|
104
238
|
|
105
|
-
SQL (16.0ms) UPDATE "users" SET "reset_digest" = '$2a$10$mP0rEY3TVbBo90YHyoms5eKR3DrmsSVCd4AwPEKpCfY6YgTWYkgty', "reset_sent_at" = '2020-02-03 14:17:51.087040' WHERE "users"."id" = ? [["id", 102]]
|
106
|
-
|
107
|
-
Rendering user_mailer/password_reset.html.erb within layouts/mailer
|
108
|
-
|
109
|
-
Rendered user_mailer/password_reset.html.erb within layouts/mailer (1.0ms)
|
110
|
-
|
111
|
-
Rendering user_mailer/password_reset.text.erb within layouts/mailer
|
112
|
-
|
113
|
-
Rendered user_mailer/password_reset.text.erb within layouts/mailer (0.0ms)
|
114
|
-
|
115
|
-
UserMailer#password_reset: processed outbound mail in 288.0ms
|
116
|
-
|
117
|
-
Sent mail to ***.***@gmail.com (2.0ms)
|
118
|
-
|
119
|
-
Date: Mon, 03 Feb 2020 23:17:51 +0900
|
120
|
-
|
121
|
-
From: noreply@example.com
|
122
|
-
|
123
|
-
To: ***.***@gmail.com
|
124
|
-
|
125
|
-
Message-ID: <5e382b8f62a73_2fb830046fc3623@DESKTOP-NGDL1L7.mail>
|
126
|
-
|
127
|
-
Subject: Password reset
|
128
|
-
|
129
|
-
Mime-Version: 1.0
|
130
|
-
|
131
|
-
Content-Type: multipart/alternative;
|
132
|
-
|
133
|
-
boundary="--==_mimepart_5e382b8f62294_2fb830046fc3528";
|
134
|
-
|
135
|
-
charset=UTF-8
|
136
|
-
|
137
|
-
Content-Transfer-Encoding: 7bit
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
144
|
-
|
145
|
-
Content-Type: text/plain;
|
146
|
-
|
147
|
-
charset=UTF-8
|
148
|
-
|
149
|
-
Content-Transfer-Encoding: 7bit
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
To reset your password click the link below:
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
This link will expire in two hours.
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
If you did not request your password to be reset, please ignore this email and
|
166
|
-
|
167
|
-
your password will stay as it is.
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
174
|
-
|
175
|
-
Content-Type: text/html;
|
176
|
-
|
177
|
-
charset=UTF-8
|
178
|
-
|
179
|
-
Content-Transfer-Encoding: 7bit
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
<!DOCTYPE html>
|
184
|
-
|
185
|
-
<html>
|
186
|
-
|
187
|
-
<head>
|
188
|
-
|
189
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
190
|
-
|
191
|
-
<style>
|
192
|
-
|
193
|
-
/* Email styles need to be inline */
|
194
|
-
|
195
|
-
</style>
|
196
|
-
|
197
|
-
</head>
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
<body>
|
202
|
-
|
203
|
-
<h1>Password reset</h1>
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<p>To reset your password click the link below:</p>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
<a href="http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com">Reset password</a>
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
<p>This link will expire in two hours.</p>
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
<p>
|
220
|
-
|
221
|
-
If you did not request your password to be reset, please ignore this email and
|
222
|
-
|
223
|
-
your password will stay as it is.
|
224
|
-
|
225
|
-
</p>
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
</body>
|
230
|
-
|
231
|
-
</html>
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
----==_mimepart_5e382b8f62294_2fb830046fc3528--
|
236
|
-
|
237
|
-
|
238
|
-
|
239
239
|
Redirected to http://localhost:3000/
|
240
240
|
|
241
|
+
Filter chain halted as :valid_user rendered or redirected
|
242
|
+
|
241
|
-
Completed 302 Found in
|
243
|
+
Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
247
|
-
Started GET "/" for 127.0.0.1 at 2020-02-03 23:1
|
249
|
+
Started GET "/" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
248
250
|
|
249
251
|
Processing by StaticPagesController#home as HTML
|
250
252
|
|
251
253
|
Rendering static_pages/home.html.erb within layouts/application
|
252
254
|
|
253
|
-
Rendered static_pages/home.html.erb within layouts/application (
|
255
|
+
Rendered static_pages/home.html.erb within layouts/application (4.0ms)
|
254
|
-
|
256
|
+
|
255
|
-
Rendered layouts/_head.html.erb (11
|
257
|
+
Rendered layouts/_head.html.erb (118.0ms)
|
256
|
-
|
258
|
+
|
257
|
-
Rendered layouts/_shim.html.erb (
|
259
|
+
Rendered layouts/_shim.html.erb (0.0ms)
|
258
260
|
|
259
261
|
Rendered layouts/_header.html.erb (1.0ms)
|
260
262
|
|
261
|
-
Rendered layouts/_footer.html.erb (0.0ms)
|
262
|
-
|
263
|
-
Completed 200 OK in 292ms (Views: 272.0ms | ActiveRecord: 0.0ms)
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
Started GET "/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=satoshi.taenaka%40gmail.com" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
270
|
-
|
271
|
-
Processing by PasswordResetsController#edit as HTML
|
272
|
-
|
273
|
-
Parameters: {"email"=>"***.***@gmail.com", "id"=>"-6kcTNIBrZspHPPJn5Aoxw"}
|
274
|
-
|
275
|
-
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "***.***@gmail.com"], ["LIMIT", 1]]
|
276
|
-
|
277
|
-
Redirected to http://localhost:3000/
|
278
|
-
|
279
|
-
Filter chain halted as :valid_user rendered or redirected
|
280
|
-
|
281
|
-
Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
Started GET "/" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
288
|
-
|
289
|
-
Processing by StaticPagesController#home as HTML
|
290
|
-
|
291
|
-
Rendering static_pages/home.html.erb within layouts/application
|
292
|
-
|
293
|
-
Rendered static_pages/home.html.erb within layouts/application (4.0ms)
|
294
|
-
|
295
|
-
Rendered layouts/_head.html.erb (118.0ms)
|
296
|
-
|
297
|
-
Rendered layouts/_shim.html.erb (0.0ms)
|
298
|
-
|
299
|
-
Rendered layouts/_header.html.erb (1.0ms)
|
300
|
-
|
301
263
|
Rendered layouts/_footer.html.erb (1.0ms)
|
302
264
|
|
303
265
|
Completed 200 OK in 292ms (Views: 271.0ms | ActiveRecord: 0.0ms)
|
3
更新しました。よろしくお願いします。
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Railsチュートリアル第12章で、
|
1
|
+
Railsチュートリアル第12章で、実装した筈のPassword Rsetフォームが現れない。
|
test
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
### 前提・実現したいこと
|
2
2
|
|
3
|
-
Railsチュートリアルの12章を進めている中で、パスワード再設定のメールアドレスを
|
3
|
+
Railsチュートリアルの12章を進めている中で、パスワード再設定のメールアドレスをサーバーでコピペし、ブラウザをリロードするのですが、
|
4
|
+
|
4
|
-
|
5
|
+
root_url(トップページ)に戻ってしまいます。
|
6
|
+
|
5
|
-
Reset passwordのページに行きません。というより、コードはもちろん記述済みなのですが、この再設定のフォーム
|
7
|
+
Reset passwordのページに行きません。というより、コードはもちろん記述済みなのですが、この再設定のフォームに繋がりません。
|
6
|
-
|
8
|
+
|
7
|
-
Forgot passwordのフォームは問題なく
|
9
|
+
Forgot passwordのフォームは問題なく現れます。
|
8
|
-
|
10
|
+
|
9
|
-
|
11
|
+
いろんなサイトを同様の事例が無いか探してみたり、チュートリアルページを何度も見直してみたのですがコードの記述に問題がなく
|
12
|
+
|
10
|
-
|
13
|
+
何がどうなっているのかわからない状態で三日ほど迷走しています。
|
14
|
+
|
11
|
-
詳しい方居られましたら、アドバイス頂けますと有難いです。よろしくお願いします。
|
15
|
+
詳しい方居られましたら、アドバイス頂けますと大変有難いです。よろしくお願いします。
|
12
16
|
|
13
17
|
|
14
18
|
|
@@ -20,9 +24,9 @@
|
|
20
24
|
|
21
25
|
エラーメッセージは、無いのですが
|
22
26
|
|
23
|
-
ローカルで、パスワード再設定フォームからアドレスを入れるとサーバーに再設定フォーム用アドレスが生成され
|
27
|
+
ローカルで、パスワード再設定フォームからアドレスを入れるとサーバーに再設定フォーム用アドレスが生成されるはずが、
|
24
|
-
|
28
|
+
|
25
|
-
root_urlになってしま
|
29
|
+
root_urlになってしまい、再設定フォームに繋がりません。
|
26
30
|
|
27
31
|
```
|
28
32
|
|
@@ -34,143 +38,43 @@
|
|
34
38
|
|
35
39
|
```ここに言語名を入力
|
36
40
|
|
37
|
-
以下は
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
render 'new'
|
76
|
-
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
def edit
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
def update
|
90
|
-
|
91
|
-
if params[:user][:password].empty? # (3) への対応
|
92
|
-
|
93
|
-
@user.errors.add(:password, :blank)
|
94
|
-
|
95
|
-
render 'edit'
|
96
|
-
|
97
|
-
elsif @user.update_attributes(user_params) # (4) への対応
|
98
|
-
|
99
|
-
log_in @user
|
100
|
-
|
101
|
-
@user.update_attribute(:reset_digest, nil)
|
102
|
-
|
103
|
-
flash[:success] = "Password has been reset."
|
104
|
-
|
105
|
-
redirect_to @user
|
106
|
-
|
107
|
-
else
|
108
|
-
|
109
|
-
render 'edit' # (2) への対応
|
110
|
-
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
private
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
def user_params
|
122
|
-
|
123
|
-
params.require(:user).permit(:password, :password_confirmation)
|
124
|
-
|
125
|
-
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
#beforeフィルタ
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
def get_user
|
134
|
-
|
135
|
-
@user = User.find_by(email: params[:email])
|
136
|
-
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
#正しいユーザーかどうか確認する
|
142
|
-
|
143
|
-
def valid_user
|
144
|
-
|
145
|
-
unless (@user && @user.activated? &&
|
146
|
-
|
147
|
-
@user.authenticated?(:reset, params[:id]))
|
148
|
-
|
149
|
-
redirect_to root_url
|
150
|
-
|
151
|
-
end
|
152
|
-
|
153
|
-
end
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
#トークンが期限切れかどうか確認する
|
158
|
-
|
159
|
-
def check_expiration
|
160
|
-
|
161
|
-
if @user.password_reset_expired?
|
162
|
-
|
163
|
-
flash[:danger] = "Password reset has expired."
|
164
|
-
|
165
|
-
redirect_to new_password_reset_url
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
end
|
41
|
+
以下はソースではなくプレビュー画面のテキストです。
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
From:
|
46
|
+
|
47
|
+
noreply@example.com
|
48
|
+
|
49
|
+
To:
|
50
|
+
|
51
|
+
eaxmple@railstutorial.org
|
52
|
+
|
53
|
+
Date:
|
54
|
+
|
55
|
+
Wed, 05 Feb 2020 13:00:15 +0000
|
56
|
+
|
57
|
+
Subject:
|
58
|
+
|
59
|
+
Password reset
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
Password reset
|
66
|
+
|
67
|
+
To reset your password click the link below:
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
Reset password
|
72
|
+
|
73
|
+
This link will expire in two hours.
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
If you did not request your password to be reset, please ignore this email and your password will stay as it is.
|
174
78
|
|
175
79
|
|
176
80
|
|
2
追加です
test
CHANGED
File without changes
|
test
CHANGED
@@ -216,7 +216,7 @@
|
|
216
216
|
|
217
217
|
From: noreply@example.com
|
218
218
|
|
219
|
-
To:
|
219
|
+
To: ***.***@gmail.com
|
220
220
|
|
221
221
|
Message-ID: <5e382b8f62a73_2fb830046fc3623@DESKTOP-NGDL1L7.mail>
|
222
222
|
|
1
サーバーログを載せてみました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,7 +146,7 @@
|
|
146
146
|
|
147
147
|
@user.authenticated?(:reset, params[:id]))
|
148
148
|
|
149
|
-
redirect_to root_url
|
149
|
+
redirect_to root_url
|
150
150
|
|
151
151
|
end
|
152
152
|
|
@@ -184,7 +184,219 @@
|
|
184
184
|
|
185
185
|
|
186
186
|
|
187
|
-
|
187
|
+
Forgot passwordメールを送って出てきたサーバーログが以下なのですが、Homeのアドレスに必ずなっていて、Reset passwordの
|
188
|
+
|
189
|
+
フォームに繋がりません。いろいろ探したコードチェックもしたのですが、何も落ち度がないのですが、なぜこんな現象が起こるのでしょうか・・。
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
Started POST "/password_resets" for 127.0.0.1 at 2020-02-03 23:17:51 +0900
|
194
|
+
|
195
|
+
Processing by PasswordResetsController#create as HTML
|
196
|
+
|
197
|
+
Parameters: {"utf8"=>"✓", "authenticity_token"=>"yD6fC+Ioj+4xoHm3hRKD7YcIyMvCvqgz0WtGPzd76Anx19rsWE6TFbOp1SdzIPN325rLS+dH/1xmiDbi19Ce2A==", "password_reset"=>"[FILTERED]", "commit"=>"Submit"}
|
198
|
+
|
199
|
+
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "***.***@gmail.com"], ["LIMIT", 1]]
|
200
|
+
|
201
|
+
SQL (16.0ms) UPDATE "users" SET "reset_digest" = '$2a$10$mP0rEY3TVbBo90YHyoms5eKR3DrmsSVCd4AwPEKpCfY6YgTWYkgty', "reset_sent_at" = '2020-02-03 14:17:51.087040' WHERE "users"."id" = ? [["id", 102]]
|
202
|
+
|
203
|
+
Rendering user_mailer/password_reset.html.erb within layouts/mailer
|
204
|
+
|
205
|
+
Rendered user_mailer/password_reset.html.erb within layouts/mailer (1.0ms)
|
206
|
+
|
207
|
+
Rendering user_mailer/password_reset.text.erb within layouts/mailer
|
208
|
+
|
209
|
+
Rendered user_mailer/password_reset.text.erb within layouts/mailer (0.0ms)
|
210
|
+
|
211
|
+
UserMailer#password_reset: processed outbound mail in 288.0ms
|
212
|
+
|
213
|
+
Sent mail to ***.***@gmail.com (2.0ms)
|
214
|
+
|
215
|
+
Date: Mon, 03 Feb 2020 23:17:51 +0900
|
216
|
+
|
217
|
+
From: noreply@example.com
|
218
|
+
|
219
|
+
To: satoshi.taenaka@gmail.com
|
220
|
+
|
221
|
+
Message-ID: <5e382b8f62a73_2fb830046fc3623@DESKTOP-NGDL1L7.mail>
|
222
|
+
|
223
|
+
Subject: Password reset
|
224
|
+
|
225
|
+
Mime-Version: 1.0
|
226
|
+
|
227
|
+
Content-Type: multipart/alternative;
|
228
|
+
|
229
|
+
boundary="--==_mimepart_5e382b8f62294_2fb830046fc3528";
|
230
|
+
|
231
|
+
charset=UTF-8
|
232
|
+
|
233
|
+
Content-Transfer-Encoding: 7bit
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
240
|
+
|
241
|
+
Content-Type: text/plain;
|
242
|
+
|
243
|
+
charset=UTF-8
|
244
|
+
|
245
|
+
Content-Transfer-Encoding: 7bit
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
To reset your password click the link below:
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
This link will expire in two hours.
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
If you did not request your password to be reset, please ignore this email and
|
262
|
+
|
263
|
+
your password will stay as it is.
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528
|
270
|
+
|
271
|
+
Content-Type: text/html;
|
272
|
+
|
273
|
+
charset=UTF-8
|
274
|
+
|
275
|
+
Content-Transfer-Encoding: 7bit
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<!DOCTYPE html>
|
280
|
+
|
281
|
+
<html>
|
282
|
+
|
283
|
+
<head>
|
284
|
+
|
285
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
286
|
+
|
287
|
+
<style>
|
288
|
+
|
289
|
+
/* Email styles need to be inline */
|
290
|
+
|
291
|
+
</style>
|
292
|
+
|
293
|
+
</head>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
<body>
|
298
|
+
|
299
|
+
<h1>Password reset</h1>
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<p>To reset your password click the link below:</p>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<a href="http://localhost:3000/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=***.***%40gmail.com">Reset password</a>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<p>This link will expire in two hours.</p>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
<p>
|
316
|
+
|
317
|
+
If you did not request your password to be reset, please ignore this email and
|
318
|
+
|
319
|
+
your password will stay as it is.
|
320
|
+
|
321
|
+
</p>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
</body>
|
326
|
+
|
327
|
+
</html>
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
----==_mimepart_5e382b8f62294_2fb830046fc3528--
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
Redirected to http://localhost:3000/
|
336
|
+
|
337
|
+
Completed 302 Found in 376ms (ActiveRecord: 16.0ms)
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
Started GET "/" for 127.0.0.1 at 2020-02-03 23:17:51 +0900
|
344
|
+
|
345
|
+
Processing by StaticPagesController#home as HTML
|
346
|
+
|
347
|
+
Rendering static_pages/home.html.erb within layouts/application
|
348
|
+
|
349
|
+
Rendered static_pages/home.html.erb within layouts/application (3.0ms)
|
350
|
+
|
351
|
+
Rendered layouts/_head.html.erb (111.0ms)
|
352
|
+
|
353
|
+
Rendered layouts/_shim.html.erb (1.0ms)
|
354
|
+
|
355
|
+
Rendered layouts/_header.html.erb (1.0ms)
|
356
|
+
|
357
|
+
Rendered layouts/_footer.html.erb (0.0ms)
|
358
|
+
|
359
|
+
Completed 200 OK in 292ms (Views: 272.0ms | ActiveRecord: 0.0ms)
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
Started GET "/password_resets/-6kcTNIBrZspHPPJn5Aoxw/edit?email=satoshi.taenaka%40gmail.com" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
366
|
+
|
367
|
+
Processing by PasswordResetsController#edit as HTML
|
368
|
+
|
369
|
+
Parameters: {"email"=>"***.***@gmail.com", "id"=>"-6kcTNIBrZspHPPJn5Aoxw"}
|
370
|
+
|
371
|
+
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = ? LIMIT ? [["email", "***.***@gmail.com"], ["LIMIT", 1]]
|
372
|
+
|
373
|
+
Redirected to http://localhost:3000/
|
374
|
+
|
375
|
+
Filter chain halted as :valid_user rendered or redirected
|
376
|
+
|
377
|
+
Completed 302 Found in 4ms (ActiveRecord: 0.0ms)
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
Started GET "/" for 127.0.0.1 at 2020-02-03 23:18:18 +0900
|
384
|
+
|
385
|
+
Processing by StaticPagesController#home as HTML
|
386
|
+
|
387
|
+
Rendering static_pages/home.html.erb within layouts/application
|
388
|
+
|
389
|
+
Rendered static_pages/home.html.erb within layouts/application (4.0ms)
|
390
|
+
|
391
|
+
Rendered layouts/_head.html.erb (118.0ms)
|
392
|
+
|
393
|
+
Rendered layouts/_shim.html.erb (0.0ms)
|
394
|
+
|
395
|
+
Rendered layouts/_header.html.erb (1.0ms)
|
396
|
+
|
397
|
+
Rendered layouts/_footer.html.erb (1.0ms)
|
398
|
+
|
399
|
+
Completed 200 OK in 292ms (Views: 271.0ms | ActiveRecord: 0.0ms)
|
188
400
|
|
189
401
|
|
190
402
|
|