Skip to content

Commit

Permalink
feat(redirect): redirect to editor
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamadreza1388 committed Sep 11, 2024
1 parent 73a3927 commit aa386ca
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
8 changes: 2 additions & 6 deletions app/Middleware/api/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,10 @@ public function before(): void
$user = $user->fetchAll();
$user = end($user);
if (intval($user['role_id']) !== 1) {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
} else {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
}
}
8 changes: 2 additions & 6 deletions app/Middleware/api/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ public function before(): void
$result = $tokenCount->fetchAll();
$result = end($result)['token_count'];
if (intval($result) === 0) {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
} else {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
}
}
8 changes: 2 additions & 6 deletions app/Middleware/mvc/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,10 @@ public function before(): void
$user = $user->fetchAll();
$user = end($user);
if (intval($user['role_id']) !== 1) {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
} else {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
}
}
8 changes: 2 additions & 6 deletions app/Middleware/mvc/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ public function before(): void
$result = $tokenCount->fetchAll();
$result = end($result)['token_count'];
if (intval($result) === 0) {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
} else {
Flight::jsonHalt($this->success([
'message' => ['Unauthorized'],
], '401'), 401);
Flight::redirect("https://editor.salamlang.ir");
}
}
}

0 comments on commit aa386ca

Please sign in to comment.