質問編集履歴
4
追記2
test
CHANGED
File without changes
|
test
CHANGED
@@ -239,3 +239,31 @@
|
|
239
239
|
|
240
240
|
|
241
241
|
としてもまだfalse
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
# 追記2
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
```php
|
252
|
+
|
253
|
+
$this->Auth->setUser(['id' => 1, 'username' => 'mymail@example.com', 'password' => 'mypassword', 'role' => 'normal']);
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
$user = $this->Auth->user()
|
258
|
+
|
259
|
+
```
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
とすれば取れるのか……
|
264
|
+
|
265
|
+
え?でもなんで、
|
266
|
+
|
267
|
+
`$user = $this->Auth->identify();`
|
268
|
+
|
269
|
+
だとfalseになるん…?
|
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -213,3 +213,29 @@
|
|
213
213
|
|
214
214
|
|
215
215
|
ご存じの方がいらっしゃいましたら、ご教示いただけますと幸いです。
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
# 追記
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
```php
|
226
|
+
|
227
|
+
$this->Auth->setUser(['id' => 1, 'username' => 'mymail@example.com', 'password' => 'mypassword', 'role' => 'normal']);
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
$user = $this->Auth->identify();
|
232
|
+
|
233
|
+
var_dump($user);
|
234
|
+
|
235
|
+
die;
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
としてもまだfalse
|
2
ちょっと進捗
test
CHANGED
File without changes
|
test
CHANGED
@@ -90,9 +90,9 @@
|
|
90
90
|
|
91
91
|
{
|
92
92
|
|
93
|
-
$this->request->withData('em
|
93
|
+
$this->request = $this->request->withData('username', 'mymail@example.com');
|
94
|
-
|
94
|
+
|
95
|
-
$this->request->withData('password', 'mypassword');
|
95
|
+
$this->request = $this->request->withData('password', 'mypassword');
|
96
96
|
|
97
97
|
|
98
98
|
|
@@ -156,7 +156,7 @@
|
|
156
156
|
|
157
157
|
'authorize' => ['Controller'],
|
158
158
|
|
159
|
-
'authenticate' => ['Form' => ['fie
|
159
|
+
'authenticate' => ['Form' => ['finder' => 'auth', 'username' => 'email', 'password' => 'password']]],
|
160
160
|
|
161
161
|
'loginRedirect' => ['controller' => 'Users', 'action' => 'index'],
|
162
162
|
|
@@ -172,6 +172,36 @@
|
|
172
172
|
|
173
173
|
|
174
174
|
|
175
|
+
UsersTable.php
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
```php
|
180
|
+
|
181
|
+
public function findAuth(Query $query, array $options)
|
182
|
+
|
183
|
+
{
|
184
|
+
|
185
|
+
$query
|
186
|
+
|
187
|
+
->select(['id', 'username', 'password'])
|
188
|
+
|
189
|
+
->where(['Users.username' => $options['username']]);
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
var_dump($query->toArray());
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
return $query;
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
```
|
202
|
+
|
203
|
+
|
204
|
+
|
175
205
|
としています。
|
176
206
|
|
177
207
|
|
1
miss
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|