This commit is contained in:
2020-11-19 20:17:34 +00:00
parent 54dc8d863b
commit ee2122929d
4 changed files with 29 additions and 3 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -177,6 +177,30 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(l));
}
/// <summary>
/// Get subset of translation values for specific translation Id
/// </summary>
/// <param name="inObj">List of translation key strings</param>
/// <returns>A key value array of translation text values</returns>
[HttpPost("subset/{id}")]
public async Task<IActionResult> SubSet([FromRoute] long id, [FromBody] List<string> inObj)
{
if (serverState.IsClosed)
{
//Exception for SuperUser account to handle licensing issues
if (UserIdFromContext.Id(HttpContext.Items) != 1)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
}
//Instantiate the business object handler
//Instantiate the business object handler
// TranslationBiz biz = TranslationBiz.GetBiz(ct, HttpContext);
var l = await TranslationBiz.GetSubsetStaticAsync(inObj, id);
return Ok(ApiOkResponse.Response(l));
}
/// <summary>

View File

@@ -258,6 +258,7 @@ namespace AyaNova.Biz
}
//Get the keys for a list of keys provided, static format for calling from other internal classes
//and remotely when fetching for things like Password reset where the user isn't logged in yet but we know their translation id
internal static async Task<Dictionary<string, string>> GetSubsetStaticAsync(List<string> param, long translationId)
{
#if (DEBUG)
@@ -354,7 +355,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//Name must be unique
if (await ct.Translation.AnyAsync(z => z.Name == proposedObj.Name && z.Id != proposedObj.Id))

View File

@@ -356,9 +356,10 @@ namespace AyaNova.Biz
var TransDict = await TranslationBiz.GetSubsetStaticAsync(TransKeysRequired, EffectiveTranslationId);
var Title = TransDict["PasswordResetMessageTitle"];
var MessageBody = TransDict["PasswordResetMessageBody"];
var loginName=Uri.EscapeDataString(dbObject.Login);
//Hello {user_name},\n\nYour online account for service is available to you after you set your password.\nYou can use the following link for the next 48 hours to set your password.\n\nSet your password: {action_link}\n\nIf you did not request an account or password reset, please ignore this email.\n\nThanks,\n{registered_to}"
MessageBody = MessageBody.Replace("{user_name}", dbObject.Name).Replace("{action_url}", $"{ServerUrl}/reset?{ResetCode}").Replace("{registered_to}", AyaNova.Core.License.ActiveKey.RegisteredTo);
MessageBody = MessageBody.Replace("{user_name}", dbObject.Name).Replace("{action_link}", $"{ServerUrl}/home-reset?{ResetCode}&tr={EffectiveTranslationId}&lg={loginName}").Replace("{registered_to}", AyaNova.Core.License.ActiveKey.RegisteredTo);
IMailer m = AyaNova.Util.ServiceProviderProvider.Mailer;
await m.SendEmailAsync(dbObject.UserOptions.EmailAddress, Title, MessageBody, ServerGlobalOpsSettingsCache.Notify);