...
This commit is contained in:
@@ -28,6 +28,10 @@ namespace Back.Services
|
||||
|
||||
}
|
||||
public async Task<VerificationCode> GetVerificationCode(int ID)
|
||||
{
|
||||
return await _verificationCodeRepo.Get(w => w.Code == ID).FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<VerificationCode> GetVerificationCodeByID(int ID)
|
||||
{
|
||||
return await _verificationCodeRepo.Get(w => w.ID == ID).FirstOrDefaultAsync();
|
||||
}
|
||||
@@ -68,7 +72,7 @@ namespace Back.Services
|
||||
public async Task<int> GenerateCode(VerificationCode code)
|
||||
{
|
||||
code.Code = Random.Shared.Next(1000, 9000);
|
||||
while (await GetVerificationCode(code.ID) != null)
|
||||
while (await GetVerificationCode(code.Code) != null)
|
||||
code.Code = Random.Shared.Next(1000, 9000);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user