Skip to content

Commit 4d25bd0

Browse files
committed
refactor: migrated forgot password page (#3834)
1 parent 2195ee6 commit 4d25bd0

File tree

5 files changed

+27
-40
lines changed

5 files changed

+27
-40
lines changed

phpmyfaq/assets/templates/default/login.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<label class="form-check-label" for="faqrememberme">{{ rememberMe }}</label>
5656
</div>
5757
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
58-
<a class="small" href="./forgot-password">{{ sendPassword }}</a>
58+
<a class="small" href="./forgot-password">{{ 'lostPassword' | translate }}</a>
5959
<button type="submit" class="btn btn-primary">{{ loginHeader }}</button>
6060
</div>
6161
</form>

phpmyfaq/assets/templates/default/password.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="col-6 offset-3">
1717
<div class="card shadow">
1818
<div class="card-header">
19-
<h4 class="card-title">{{ 'lostPassword' | translate }}</h4>
19+
<h2 class="text-center font-weight-light my-4">{{ 'lostPassword' | translate }}</h2>
2020
</div>
2121
<div class="card-body">
2222
<form id="pmf-password-form" action="#" method="post" accept-charset="utf-8" class="needs-validation"

phpmyfaq/password.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

phpmyfaq/src/phpMyFAQ/Controller/Frontend/LoginController.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,24 @@ public function index(Request $request): Response
7171
'isWebAuthnEnabled' => $this->configuration->get('security.enableWebAuthnSupport'),
7272
]);
7373
}
74+
75+
/**
76+
* @throws Exception
77+
* @throws LoaderError
78+
* @throws \Exception
79+
*/
80+
#[Route(path: '/forgot-password', name: 'public.forgot-password')]
81+
public function forgotPassword(Request $request): Response
82+
{
83+
$faqSession = $this->container->get('phpmyfaq.user.session');
84+
$faqSession->setCurrentUser($this->currentUser);
85+
$faqSession->userTracking('forgot_password', 0);
86+
87+
return $this->render('password.twig', [
88+
...$this->getHeader($request),
89+
'lang' => $this->configuration->getLanguage()->getLanguage(),
90+
'username' => Translation::get(key: 'ad_auth_user'),
91+
'password' => Translation::get(key: 'ad_auth_passwd'),
92+
]);
93+
}
7494
}

phpmyfaq/src/public-routes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
'controller' => [ContactController::class, 'index'],
3838
'methods' => 'GET|POST',
3939
],
40+
'public.forgot-password' => [
41+
'path' => '/forgot-password',
42+
'controller' => [LoginController::class, 'forgotPassword'],
43+
'methods' => 'GET|POST',
44+
],
4045
'public.glossary' => [
4146
'path' => '/glossary.html',
4247
'controller' => [GlossaryController::class, 'index'],

0 commit comments

Comments
 (0)