Compare commits

..

No commits in common. "732918de53dfe749e0715f25bd78edb86c74b112" and "214654f69625a1c0dd300f4c6c3eaa5c14e5e318" have entirely different histories.

2 changed files with 3 additions and 6 deletions

View File

@ -2,13 +2,13 @@
namespace AyCode.Core.Helpers
{
public static class AcCharsGenerator
public static class AcCharGenerator
{
public static readonly char[] Letters;
public static readonly char[] Numbers;
public static readonly char[] LettersAndNumbers;
static AcCharsGenerator()
static AcCharGenerator()
{
//"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
@ -23,7 +23,6 @@ namespace AyCode.Core.Helpers
private static char[] GetRandomChars(int minLength, int maxLength) => GetRandomChars(LettersAndNumbers, minLength, maxLength);
private static char[] GetRandomChars(char[] sourceChars, int minLength, int maxLength)
{
if (minLength < 1) throw new ArgumentOutOfRangeException(nameof(minLength), "must have length greater than or equal to 1");
var random = new Random();
return Enumerable.Repeat(sourceChars, random.Next(minLength, maxLength)).Select(s => s[random.Next(s.Length)]).ToArray();
}
@ -33,7 +32,7 @@ namespace AyCode.Core.Helpers
return new string(GetRandomChars(AcConst.MinUserTokenLength, AcConst.MaxUserTokenLength));
}
public static string NewPassword(int minLength = AcConst.MinPasswordLength, int maxLength = AcConst.MaxPasswordLength)
public static string NewPassword()
{
return new string(GetRandomChars(AcConst.MinPasswordLength, AcConst.MaxPasswordLength));
}

View File

@ -55,10 +55,8 @@ namespace AyCode.Database.DataLayers.Users
=> GetAllModelDtoAsync<TUserModelDto, TUser>();
public Task<List<TUser>> GetUsersAsync() => SessionAsync(ctx => ctx.Users.ToList());
//public Task<List<TUserModelDto>> GetUserEmails() => SessionAsync(ctx => ctx.Users.Select(x => new UserModelDtoEmail(x)).ToList());
public Task<bool> AddUserAsync(TUser user)
{
return TransactionAsync(ctx => ctx.AddUser(user));