IMPR: add change password URL. Ref: https://web.dev/change-password-url/

This commit is contained in:
Tony Air 2022-01-07 20:33:51 +02:00
parent ec57485d4e
commit b9c982bd08
3 changed files with 37 additions and 2 deletions

View File

@ -6,6 +6,7 @@ SilverStripe\Control\Director:
rules: rules:
'manifest.json': 'A2nt\ProgressiveWebApp\Controllers\ManifestController' 'manifest.json': 'A2nt\ProgressiveWebApp\Controllers\ManifestController'
'sw.js/$Action': 'A2nt\ProgressiveWebApp\Controllers\ServiceWorkerController' 'sw.js/$Action': 'A2nt\ProgressiveWebApp\Controllers\ServiceWorkerController'
'.well-known/$Action!': 'A2nt\ProgressiveWebApp\Controllers\WellKnownController'
SilverStripe\CMS\Model\SiteTree: SilverStripe\CMS\Model\SiteTree:
extensions: extensions:

View File

@ -16,9 +16,8 @@ class ManifestController extends Controller
* @var array * @var array
*/ */
private static $allowed_actions = [ private static $allowed_actions = [
'index' 'index',
]; ];
/** /**
* Default controller action for the manifest.json file * Default controller action for the manifest.json file
* *

View File

@ -0,0 +1,35 @@
<?php
namespace A2nt\ProgressiveWebApp\Controllers;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Director;
use SilverStripe\Security\Security;
class WellKnownController extends Controller
{
private static $allowed_actions = [
'index',
];
public function index()
{
$req = $this->getRequest();
$action = $req->param('Action');
switch($action) {
case 'change-password':
return $this->changepassword();
default:
return $this->httpError(404, 'Not found');
}
}
public function changepassword()
{
return $this->redirect(
Director::absoluteURL(
Security::singleton()->Link('changepassword')
), 303
);
}
}