-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathAccountError.cs
More file actions
30 lines (24 loc) · 1.26 KB
/
AccountError.cs
File metadata and controls
30 lines (24 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Net;
using OpenShock.Common.Problems;
using OpenShock.Common.Validation;
namespace OpenShock.Common.Errors;
public static class AccountError
{
public static OpenShockProblem UsernameTaken => new OpenShockProblem("Account.Username.Taken",
"This username is already in use", HttpStatusCode.Conflict);
public static OpenShockProblem UsernameInvalid(UsernameError usernameError) => new OpenShockProblem(
"Account.Username.Invalid",
"This username is invalid", HttpStatusCode.BadRequest)
{
Extensions = new Dictionary<string, object?>
{
{ "usernameError", usernameError }
}
};
public static OpenShockProblem PasswordChangeInvalidPassword => new OpenShockProblem(
"Account.Password.OldPasswordInvalid", "The old password is invalid", HttpStatusCode.Forbidden);
public static OpenShockProblem UsernameRecentlyChanged => new OpenShockProblem(
"Account.Username.RecentlyChanged", "You have recently changed your username. You can only change your username every 7 days", HttpStatusCode.Forbidden);
public static OpenShockProblem AccountDeactivated => new OpenShockProblem(
"Account.Deactivated", "Your account has been deactivated.", HttpStatusCode.Unauthorized);
}