| @@ 33-46 (lines=14) @@ | ||
| 30 | ||
| 31 | public function loginWithPassword(Entity\EmailIdentity $identity, $password) |
|
| 32 | { |
|
| 33 | if ($identity->matchPassword($password) === false) { |
|
| 34 | $this->logger->warning('wrong password', [ |
|
| 35 | 'input' => [ |
|
| 36 | 'identifier' => $identity->getIdentifier(), |
|
| 37 | 'key' => md5($password), |
|
| 38 | ], |
|
| 39 | 'account' => [ |
|
| 40 | 'user' => $identity->getUserId(), |
|
| 41 | 'identity' => $identity->getId(), |
|
| 42 | ], |
|
| 43 | ]); |
|
| 44 | ||
| 45 | throw new PasswordNotMatch; |
|
| 46 | } |
|
| 47 | ||
| 48 | $this->registerUsageOfIdentity($identity); |
|
| 49 | $cookie = $this->createCookieIdentity($identity); |
|
| @@ 235-249 (lines=15) @@ | ||
| 232 | { |
|
| 233 | $mapper = $this->mapperFactory->create(Mapper\EmailIdentity::class); |
|
| 234 | ||
| 235 | if ($identity->matchPassword($oldPassword) === false) { |
|
| 236 | $this->logger->warning('wrong password', [ |
|
| 237 | 'input' => [ |
|
| 238 | 'user' => $identity->getUserId(), |
|
| 239 | 'old-key' => md5($oldPassword), |
|
| 240 | 'new-key' => md5($newPassword), |
|
| 241 | ], |
|
| 242 | 'account' => [ |
|
| 243 | 'user' => $identity->getUserId(), |
|
| 244 | 'identity' => $identity->getId(), |
|
| 245 | ], |
|
| 246 | ]); |
|
| 247 | ||
| 248 | throw new PasswordNotMatch; |
|
| 249 | } |
|
| 250 | ||
| 251 | $identity->setPassword($newPassword); |
|
| 252 | $mapper->store($identity); |
|