Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
PasswordController
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 6
90
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 reminder_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 reminder_post
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
12
 reminding
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 reset_get
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 reset_post
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Controllers\Page;
6
7use Exception;
8use PeServer\App\Controllers\Page\PageControllerBase;
9use PeServer\App\Models\Domain\Page\Password\PasswordReminderLogic;
10use PeServer\App\Models\Domain\Page\Password\PasswordRemindingLogic;
11use PeServer\App\Models\Domain\Page\Password\PasswordResetLogic;
12use PeServer\Core\Mvc\ControllerArgument;
13use PeServer\Core\Mvc\LogicCallMode;
14use PeServer\Core\Mvc\Result\IActionResult;
15use PeServer\Core\Throws\InvalidOperationException;
16
17/**
18 * [PAGE] パスワードコントローラ。
19 */
20final class PasswordController extends PageControllerBase
21{
22    public function __construct(ControllerArgument $argument)
23    {
24        parent::__construct($argument);
25    }
26
27    // public function index(): IActionResult
28    // {
29    // }
30
31    public function reminder_get(): IActionResult
32    {
33        $logic = $this->createLogic(PasswordReminderLogic::class);
34        $logic->run(LogicCallMode::Initialize);
35
36        return $this->view('reminder', $logic->getViewData());
37    }
38
39    public function reminder_post(): IActionResult
40    {
41        $logic = $this->createLogic(PasswordReminderLogic::class);
42        if ($logic->run(LogicCallMode::Submit)) {
43            if ($logic->tryGetResult('token', $token)) {
44                return $this->redirectPath("password/reminding/$token");
45            }
46            throw new InvalidOperationException();
47        }
48
49        return $this->view('reminder', $logic->getViewData());
50    }
51
52    public function reminding(): IActionResult
53    {
54        $logic = $this->createLogic(PasswordRemindingLogic::class);
55        $logic->run(LogicCallMode::Initialize);
56
57        return $this->view('reminding', $logic->getViewData());
58    }
59
60    public function reset_get(): IActionResult
61    {
62        $logic = $this->createLogic(PasswordResetLogic::class);
63        $logic->run(LogicCallMode::Initialize);
64
65        return $this->view('reset', $logic->getViewData());
66    }
67
68    public function reset_post(): IActionResult
69    {
70        $logic = $this->createLogic(PasswordResetLogic::class);
71        if ($logic->run(LogicCallMode::Submit)) {
72            return $this->redirectPath("");
73        }
74
75        return $this->view('reset', $logic->getViewData());
76    }
77}