1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-08-18 18:24:56 +02:00
Files
.config
.run
.workdir
Agent
Common
Controller
Phantom.Controller
Phantom.Controller.Database
Phantom.Controller.Database.Postgres
Phantom.Controller.Minecraft
Phantom.Controller.Rpc
Phantom.Controller.Services
Agents
Audit
Events
Instances
Rpc
Users
AddRoleError.cs
AddUserError.cs
DeleteUserResult.cs
PasswordRequirementViolation.cs
RoleManager.cs
SetUserPasswordError.cs
UserManager.cs
UserPasswords.cs
UserRoleManager.cs
Phantom.Controller.Services.csproj
ServiceConfiguration.cs
Docker
Utils
Web
.dockerignore
.gitattributes
.gitignore
AddMigration.bat
AddMigration.sh
Directory.Build.props
Directory.Build.targets
Dockerfile
LICENSE
Packages.props
PhantomPanel.sln
README.md
global.json
Minecraft-Phantom-Panel/Controller/Phantom.Controller.Services/Users/SetUserPasswordError.cs

24 lines
833 B
C#

using System.Collections.Immutable;
namespace Phantom.Server.Services.Users;
public abstract record SetUserPasswordError {
private SetUserPasswordError() {}
public sealed record UserNotFound : SetUserPasswordError;
public sealed record PasswordIsInvalid(ImmutableArray<PasswordRequirementViolation> Violations) : SetUserPasswordError;
public sealed record UnknownError : SetUserPasswordError;
}
public static class SetUserPasswordErrorExtensions {
public static string ToSentences(this SetUserPasswordError error, string delimiter) {
return error switch {
SetUserPasswordError.UserNotFound => "User not found.",
SetUserPasswordError.PasswordIsInvalid e => string.Join(delimiter, e.Violations.Select(static v => v.ToSentence())),
_ => "Unknown error."
};
}
}