Email change on user

This commit is contained in:
2024-07-27 02:52:24 +02:00
parent 683b6020b7
commit 12f7176467
6 changed files with 86 additions and 25 deletions
+4 -4
View File
@@ -42,12 +42,12 @@ class Users extends Api
// Fetch all inputs.
$username = Input::patch("username");
$password = Input::patch("password");
$image = Input::file("image");
$email = Input::patch("email");
// Try and update user.
// Throw errors according to situation.
try {
Response::json(User::getByID($id)->update($username, $password, $image));
Response::json(User::getByID($id)->update($username, $password, $email));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
@@ -65,12 +65,12 @@ class Users extends Api
$token = Request::token();
$username = Input::patch("username");
$password = Input::patch("password");
$image = Input::file("image");
$email = Input::patch("email");
// Try and update user.
// Throw errors according to situation.
try {
Response::json(User::getByToken($token)->update($username, $password, $image));
Response::json(User::getByToken($token)->update($username, $password, $email));
} catch (Exception $err) {
switch ($err->getMessage()) {
case "NotFound":
+13 -4
View File
@@ -254,7 +254,12 @@ paths:
$ref: "#/components/schemas/FailedUpdateResponse"
examples:
Failed:
value: { "code": "FailedUpdate", "fields": ["content"] }
value:
{
"code": "FailedUpdate",
"fields": ["content"],
"reasons": ["string"],
}
tags:
- Post
delete:
@@ -481,7 +486,8 @@ paths:
value:
{
"code": "FailedUpdate",
"fields": ["username", "password", "image"],
"fields": ["username", "password", "email"],
"reasons": ["string", "string", "string"],
}
tags:
- User
@@ -572,6 +578,10 @@ components:
type: array
items:
type: string
reasons:
type: array
items:
type: string
ErrorResponse:
type: object
properties:
@@ -629,9 +639,8 @@ components:
type: string
password:
type: string
image:
email:
type: string
format: binary
RegisterRequest:
type: object
required:
File diff suppressed because one or more lines are too long