User management form
This commit is contained in:
29
OpenSaveCloudClient/Core/PasswordTool.cs
Normal file
29
OpenSaveCloudClient/Core/PasswordTool.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using PasswordGenerator;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenSaveCloudClient.Core
|
||||
{
|
||||
public class PasswordTool
|
||||
{
|
||||
private PasswordTool() { }
|
||||
|
||||
public static bool CheckRequirements(string password)
|
||||
{
|
||||
if (password.Length < 6)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string GeneratePassword()
|
||||
{
|
||||
Password pwd = new(12);
|
||||
return pwd.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -679,7 +679,7 @@ namespace OpenSaveCloudClient.Core
|
||||
return null;
|
||||
}
|
||||
|
||||
public User? DeleteUser(long userId)
|
||||
public bool DeleteUser(long userId)
|
||||
{
|
||||
logManager.AddInformation("Delete a user and all his datas");
|
||||
string uuidTask = taskManager.StartTask("Deleting user", true, 1);
|
||||
@@ -692,7 +692,7 @@ namespace OpenSaveCloudClient.Core
|
||||
{
|
||||
string responseText = response.Content.ReadAsStringAsync().Result;
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Ended);
|
||||
return JsonSerializer.Deserialize<User>(responseText);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -705,7 +705,7 @@ namespace OpenSaveCloudClient.Core
|
||||
logManager.AddError(ex);
|
||||
taskManager.UpdateTaskStatus(uuidTask, AsyncTaskStatus.Failed);
|
||||
}
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ChangePassword(NewPassword password)
|
||||
|
||||
Reference in New Issue
Block a user