mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-11 20:42:27 +00:00
Cleanup code
This commit is contained in:
parent
1ec7bdf1f6
commit
b0b9ad2172
58 changed files with 310 additions and 424 deletions
|
@ -4,8 +4,8 @@ using JetBrains.Annotations;
|
|||
using Kettu;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Logging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
||||
{
|
||||
|
@ -24,32 +24,27 @@ namespace LBPUnion.ProjectLighthouse.Maintenance.Commands
|
|||
User? user = await this._database.Users.FirstOrDefaultAsync(u => u.Username == onlineId);
|
||||
if (user == null)
|
||||
{
|
||||
user = await this._database.CreateUser(onlineId,
|
||||
HashHelper.BCryptHash(password));
|
||||
Logger.Log(
|
||||
$"Created user {user.UserId} with online ID (username) {user.Username} and the specified password.", LoggerLevelLogin.Instance);
|
||||
user = await this._database.CreateUser(onlineId, HashHelper.BCryptHash(password));
|
||||
Logger.Log($"Created user {user.UserId} with online ID (username) {user.Username} and the specified password.", LoggerLevelLogin.Instance);
|
||||
|
||||
user.PasswordResetRequired = true;
|
||||
Logger.Log("This user will need to reset their password when they log in.",
|
||||
LoggerLevelLogin.Instance);
|
||||
Logger.Log("This user will need to reset their password when they log in.", LoggerLevelLogin.Instance);
|
||||
|
||||
await this._database.SaveChangesAsync();
|
||||
Logger.Log("Database changes saved.",
|
||||
LoggerLevelDatabase.Instance);
|
||||
Logger.Log("Database changes saved.", LoggerLevelDatabase.Instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Log("A user with this username already exists.",
|
||||
LoggerLevelLogin.Instance);
|
||||
Logger.Log("A user with this username already exists.", LoggerLevelLogin.Instance);
|
||||
}
|
||||
}
|
||||
|
||||
public string Name() => "Create New User";
|
||||
|
||||
public string[] Aliases() =>
|
||||
new[]
|
||||
public string[] Aliases()
|
||||
=> new[]
|
||||
{
|
||||
"useradd", "adduser", "newuser", "createUser"
|
||||
"useradd", "adduser", "newuser", "createUser",
|
||||
};
|
||||
|
||||
public string Arguments() => "<OnlineID> <Password>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue