diff --git a/server/AyaNova/Controllers/AuthController.cs b/server/AyaNova/Controllers/AuthController.cs
index 93cc38d2..a94df880 100644
--- a/server/AyaNova/Controllers/AuthController.cs
+++ b/server/AyaNova/Controllers/AuthController.cs
@@ -374,7 +374,7 @@ namespace AyaNova.Api.Controllers
await Task.Delay(nFailDelay);
return StatusCode(401, new ApiErrorResponse(ApiErrorCode.AUTHENTICATION_FAILED));
}
-
+
//vet the expiry
var utcNow = new DateTimeOffset(DateTime.Now.ToUniversalTime(), TimeSpan.Zero);
if (user.PasswordResetCodeExpire < utcNow.DateTime)
@@ -396,7 +396,7 @@ namespace AyaNova.Api.Controllers
///
/// User id
/// From route path
- /// NoContent
+ /// New concurrency code
[HttpPost("request-reset-password/{id}")]
public async Task SendPasswordResetCode([FromRoute] long id, ApiVersion apiVersion)
{
@@ -408,11 +408,14 @@ namespace AyaNova.Api.Controllers
return StatusCode(403, new ApiNotAuthorizedResponse());
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
- bool successfulOperation = await biz.SendPasswordResetCode(id);
- if (successfulOperation == false)
+ uint res = await biz.SendPasswordResetCode(id);
+ if (res == 0)
return BadRequest(new ApiErrorResponse(biz.Errors));
else
- return NoContent();
+ return Ok(ApiOkResponse.Response(new
+ {
+ concurrency = res
+ }));
}
//------------------------------------------------------
diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs
index effc2707..821ef524 100644
--- a/server/AyaNova/biz/UserBiz.cs
+++ b/server/AyaNova/biz/UserBiz.cs
@@ -318,25 +318,25 @@ namespace AyaNova.Biz
/////////////////////////////////////////////
// GENERATE AND EMAIL Password reset code
//
- internal async Task SendPasswordResetCode(long userId)
+ internal async Task 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;
}