Răsfoiți Sursa

Deny formLogin access if already logged in (#9598)

Follow-up of https://github.com/FreshRSS/FreshRSS/pull/9592

There is no reason for logged in users to have access to the login page.
Inverle 1 zi în urmă
părinte
comite
2584514db3
2 a modificat fișierele cu 7 adăugiri și 0 ștergeri
  1. 1 0
      CHANGELOG.md
  2. 6 0
      app/Controllers/authController.php

+ 1 - 0
CHANGELOG.md

@@ -42,6 +42,7 @@ See also [the FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases).
 	* Fix search references [#9591](https://github.com/FreshRSS/FreshRSS/pull/9591)
 	* Prevent use of irrelevant parameter is shared user queries [#9589](https://github.com/FreshRSS/FreshRSS/pull/9589)
 	* Fix user enumeration by probing inconsistent error responses on failed logins [#9568](https://github.com/FreshRSS/FreshRSS/pull/9568)
+	* Deny formLogin access if already logged in [#9598](https://github.com/FreshRSS/FreshRSS/pull/9598)
 	* Better sanitize bookmark [#9594](https://github.com/FreshRSS/FreshRSS/pull/9594)
 	* Fix escape labels during JSON import and render tag dropdown as text [#9504](https://github.com/FreshRSS/FreshRSS/pull/9504)
 	* Document threat model for security scanners [#9509](https://github.com/FreshRSS/FreshRSS/pull/9509)

+ 6 - 0
app/Controllers/authController.php

@@ -72,6 +72,7 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
 	public function loginAction(): void {
 		if (FreshRSS_Auth::hasAccess()) {
 			Minz_Request::forward(['c' => 'index', 'a' => 'index'], true);
+			return;
 		}
 
 		$auth_type = FreshRSS_Context::systemConf()->auth_type;
@@ -127,6 +128,11 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController {
 	 * @throws Exception
 	 */
 	public function formLoginAction(): void {
+		if (FreshRSS_Auth::hasAccess()) {
+			Minz_Request::forward(['c' => 'index', 'a' => 'index'], true);
+			return;
+		}
+
 		invalidateHttpCache();
 
 		FreshRSS_View::prependTitle(_t('gen.auth.login') . ' · ');