mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
Update framework standards
This commit is contained in:
parent
232e056299
commit
09a91a998e
17 changed files with 282 additions and 98 deletions
|
@ -2,7 +2,7 @@
|
|||
use function Safe\session_unset;
|
||||
|
||||
try{
|
||||
HttpInput::ValidateRequestMethod([HttpMethod::Post]);
|
||||
HttpInput::ValidateRequestMethod([Enums\HttpMethod::Post]);
|
||||
|
||||
session_start();
|
||||
|
||||
|
@ -21,18 +21,18 @@ try{
|
|||
|
||||
session_unset();
|
||||
|
||||
if($requestType == HttpRequestType::Web){
|
||||
if($requestType == Enums\HttpRequestType::Web){
|
||||
http_response_code(303);
|
||||
header('Location: ' . $redirect);
|
||||
}
|
||||
else{
|
||||
// Access via HttpRequestType::Rest api; 201 CREATED with location
|
||||
// Access via Enums\HttpRequestType::Rest api; 201 CREATED with location
|
||||
http_response_code(201);
|
||||
header('Location: ' . $session->Url);
|
||||
}
|
||||
}
|
||||
catch(Exceptions\InvalidLoginException | Exceptions\PasswordRequiredException $ex){
|
||||
if($requestType == HttpRequestType::Web){
|
||||
if($requestType == Enums\HttpRequestType::Web){
|
||||
$_SESSION['email'] = $email;
|
||||
$_SESSION['redirect'] = $redirect;
|
||||
$_SESSION['exception'] = $ex;
|
||||
|
@ -42,7 +42,7 @@ catch(Exceptions\InvalidLoginException | Exceptions\PasswordRequiredException $e
|
|||
header('Location: /sessions/new');
|
||||
}
|
||||
else{
|
||||
// Access via HttpRequestType::Rest api; 422 Unprocessable Entity
|
||||
// Access via Enums\HttpRequestType::Rest api; 422 Unprocessable Entity
|
||||
http_response_code(422);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue