Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public function __invoke(Request $request): Response |
||
27 | { |
||
28 | $data = json_decode($request->getContent(), true); |
||
29 | $token = $data['token']; |
||
30 | |||
31 | $user = $this->userManager->findUserByConfirmationToken($token); |
||
32 | |||
33 | if (null === $user) { |
||
34 | throw new BadRequestException($this->translator->trans('registration.token_invalid', [], 'PnUser')); |
||
35 | } |
||
36 | |||
37 | $user->setEnabled(true); |
||
38 | $user->setConfirmationToken(null); |
||
39 | $this->userManager->updateUser($user); |
||
40 | |||
41 | return new JsonResponse(['success' => true]); |
||
42 | } |
||
44 |