Skip to content

Commit

Permalink
Solved the security bug after login!
Browse files Browse the repository at this point in the history
  • Loading branch information
khodakhah committed Oct 2, 2021
1 parent 99eadbf commit af53ec7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 62 deletions.
2 changes: 1 addition & 1 deletion nodcms-core/Config/Filters.php
Expand Up @@ -38,6 +38,6 @@ class Filters extends BaseConfig
// 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
public $filters = [
'urlLocale' => ['before' => ['[a-z]{2}', '[a-z]{2}/*'], 'after' => []],
'identityVerification' => ['before' => ['admin/*', 'user/*'], 'after' => []],
'identityVerification' => ['before' => ['admin', 'admin/*', 'admin-*', 'user/*'], 'after' => []],
];
}
4 changes: 3 additions & 1 deletion nodcms-core/Filters/IdentityVerification.php
Expand Up @@ -37,8 +37,10 @@ public function before(RequestInterface $request, $arguments = null)
{
$response = Services::quickResponse();

$lang = Services::language()->getLocale();

if(!Services::identity()->isValid()){
return $response->getError(lang("Please login to access this page."), "/admin-sign");
return $response->getError(lang("Please login to access this page."), "/{$lang}/login");
}

if(!Services::identity()->isActive()) {
Expand Down
59 changes: 0 additions & 59 deletions nodcms-layout/Views/nodcms_admin_login.php

This file was deleted.

2 changes: 1 addition & 1 deletion nodcms-users/Config/Routes.php
Expand Up @@ -23,7 +23,7 @@

$namespace = "\NodCMS\Users\Controllers\\";

$routes->match(['post', 'get'],'{locale}/(admin-sign|login)', "{$namespace}Users::login");
$routes->match(['post', 'get'],'{locale}/login', "{$namespace}Users::login");
$routes->get('account-locked', "{$namespace}Users::accountLocked");
$routes->get('{locale}/account-locked', "{$namespace}Users::accountLocked");
$routes->get('logout', "{$namespace}Users::logout");
Expand Down

0 comments on commit af53ec7

Please sign in to comment.