This commit is contained in:
2020-11-19 23:25:21 +00:00
parent 7474c77004
commit 0467f5f185
2 changed files with 13 additions and 10 deletions

View File

@@ -318,25 +318,25 @@ namespace AyaNova.Biz
/////////////////////////////////////////////
// GENERATE AND EMAIL Password reset code
//
internal async Task<bool> SendPasswordResetCode(long userId)
internal async Task<uint> SendPasswordResetCode(long userId)
{
User dbObject = await ct.User.Include(o => o.UserOptions).FirstOrDefaultAsync(z => z.Id == userId);
if (dbObject == null)
{
AddError(ApiErrorCode.NOT_FOUND);
return false;
return 0;
}
if (string.IsNullOrWhiteSpace(dbObject.UserOptions.EmailAddress))
{
AddError(ApiErrorCode.VALIDATION_REQUIRED, "EmailAddress");
return false;
return 0;
}
var ServerUrl = ServerGlobalOpsSettingsCache.Notify.AyaNovaServerURL;
if (string.IsNullOrWhiteSpace(ServerUrl))
{
await NotifyEventProcessor.AddOpsProblemEvent("User::SendPasswordResetCode - The OPS Notification setting is empty for AyaNova Server URL. This prevents Notification system from linking events to openable objects.");
AddError(ApiErrorCode.VALIDATION_REQUIRED, "ServerUrl", "Error: no server url configured in notification settings. Can't direct user to server for login. Set server URL and try again.");
return false;
return 0;
}
var ResetCode = Hasher.GetRandomAlphanumericString(32);
@@ -366,7 +366,7 @@ namespace AyaNova.Biz
//Log modification and save context
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, dbObject.Id, BizType, AyaEvent.Modified, "SendPasswordResetCode"), ct);
return true;
return dbObject.Concurrency;
}