Added http response code

This commit is contained in:
neerholt
2021-03-19 13:25:27 +01:00
parent 409556ca2e
commit 171e0a3765
18 changed files with 103 additions and 112 deletions
+7 -7
View File
@@ -8,16 +8,16 @@ if(isLogin()){
$password = Password::firstWhere("group_id", groupViaToken($_SESSION["token"])->id);
if(passwordValidate($pass = $_POST['password'])){
$password->password = password_hash($pass,PASSWORD_DEFAULT);
$password->save();
header("location: ../../../Frontend/index.html?success=PasswordUpdated");
exit();
if(!$password->save()){
http_response_code(500);
}else{
http_response_code(201);
}
}
}else{
header("location: ../../../Frontend/index.html?error=CouldNotUpdated");
exit();
http_response_code(400);
}
}else{
header("location: ../../../Frontend/index.html?error=NotLogin");
exit();
http_response_code(401);
}