Przeglądaj źródła

Ticket #4971 - Build-in API support: Redirect to home from forgot password page for logged in.

AntonLV 1 rok temu
rodzic
commit
bb6bde3466
1 zmienionych plików z 10 dodań i 10 usunięć
  1. 10 10
      template/scripts/BxBaseServiceAccount.php

+ 10 - 10
template/scripts/BxBaseServiceAccount.php

@@ -617,18 +617,18 @@ class BxBaseServiceAccount extends BxDol
      */
     public function serviceForgotPassword()
     {
-        if(isLogged()){
-            $bApi = bx_is_api();
-            if($bApi) {
-               return [
-                    bx_api_get_msg(_t("_sys_txt_forgot_pasword_logged_in"), ['ext' => ['msg_type' => 'result']]),
-                ];
+        $bApi = bx_is_api();
+
+        if (isLogged() && 'forgot-password' == bx_get('i')) {
+            if (!$bApi) {
+                header('Location: ' . BX_DOL_URL_ROOT);
+                exit;
             }
-            header('Location: ' . BX_DOL_URL_ROOT);
-            exit;
+            else
+                return [
+                    ['id' => 2, 'type' => 'redirect', 'data' => ['uri' => '/']],
+                ];
         }
-        
-        $bApi = bx_is_api();
 
         if (bx_get('key') !== false)
             return $this->resetPassword();