This commit is contained in:
@@ -101,7 +101,7 @@ namespace Sockeye.Api.Controllers
|
|||||||
TrialLicenseRequest o = await biz.CreateAsync(newObject);
|
TrialLicenseRequest o = await biz.CreateAsync(newObject);
|
||||||
if (o == null)
|
if (o == null)
|
||||||
{
|
{
|
||||||
var msg = ($"Unexpected error (code SE-444 was returned to customer) processing a new trial license request:{biz.GetErrorsAsString}");
|
var msg = ($"Unexpected error (code SE-444 was returned to customer) processing a new trial license request:{biz.GetErrorsAsString}");
|
||||||
log.LogError(msg);
|
log.LogError(msg);
|
||||||
await NotifyEventHelper.AddOpsProblemEvent(msg);
|
await NotifyEventHelper.AddOpsProblemEvent(msg);
|
||||||
return BadRequest($"E1000 - Error processing request code SE-444 contact support");//don't want to leak any info so need to check sockeye log if get this error
|
return BadRequest($"E1000 - Error processing request code SE-444 contact support");//don't want to leak any info so need to check sockeye log if get this error
|
||||||
@@ -124,7 +124,7 @@ namespace Sockeye.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
//is there a valid trial request
|
//is there a valid trial request
|
||||||
var req = await ct.TrialLicenseRequest.AsNoTracking().Where(z => z.EmailConfirmCode == code && z.Status == TrialRequestStatus.AwaitingEmailValidation).FirstOrDefaultAsync();
|
var req = await ct.TrialLicenseRequest.AsNoTracking().Where(z => z.EmailConfirmCode == code).FirstOrDefaultAsync();//&& z.Status == TrialRequestStatus.AwaitingEmailValidation
|
||||||
if (req == null)
|
if (req == null)
|
||||||
{
|
{
|
||||||
return new ContentResult
|
return new ContentResult
|
||||||
@@ -135,6 +135,18 @@ namespace Sockeye.Api.Controllers
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Legit code but they already validated email, if so then just return that it's ok so they don't keep thinking something's wrong
|
||||||
|
//but there's no need to keep processing it, it's done
|
||||||
|
if (req.EmailValidated)
|
||||||
|
{
|
||||||
|
return new ContentResult
|
||||||
|
{
|
||||||
|
ContentType = "text/html",
|
||||||
|
StatusCode = 200,
|
||||||
|
Content = "<html><body><h4>Email validated!</h4><p>Your request will be reviewed and processed by our staff <strong>during business hours</strong>. You will receive an email with instructions for starting your AyaNova evaluation.</p></body></html>"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
TrialLicenseRequestBiz biz = TrialLicenseRequestBiz.GetBiz(ct);
|
TrialLicenseRequestBiz biz = TrialLicenseRequestBiz.GetBiz(ct);
|
||||||
var tlr = await biz.GetAsync(req.Id);
|
var tlr = await biz.GetAsync(req.Id);
|
||||||
if (tlr == null)
|
if (tlr == null)
|
||||||
|
|||||||
@@ -565,9 +565,10 @@ namespace Sockeye
|
|||||||
|
|
||||||
if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
||||||
{
|
{
|
||||||
_newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
|
throw new InvalidOperationException("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - Sockeye must be erased via psql to protect data from accidental deletion");
|
||||||
Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
|
// _newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
|
||||||
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
// Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
|
||||||
|
// AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -663,12 +664,12 @@ namespace Sockeye
|
|||||||
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
||||||
|
|
||||||
|
|
||||||
if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
// if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
||||||
{
|
// {
|
||||||
_newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - IMPORTING ROCKFISH");
|
// _newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - IMPORTING ROCKFISH");
|
||||||
GlobalBizSettingsBiz.ImportRockfish(_newLog).Wait();
|
// GlobalBizSettingsBiz.ImportRockfish(_newLog).Wait();
|
||||||
_newLog.LogInformation("IMPORT COMPLETED");
|
// _newLog.LogInformation("IMPORT COMPLETED");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ namespace Sockeye.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//CREATE
|
//CREATE
|
||||||
//
|
//
|
||||||
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject, bool importingDoNotNotify = false)
|
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject)
|
||||||
{
|
{
|
||||||
await ValidateAsync(newObject, null);
|
await ValidateAsync(newObject, null);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
@@ -53,8 +53,7 @@ namespace Sockeye.Biz
|
|||||||
//Process a new request / Generate an email confirm code
|
//Process a new request / Generate an email confirm code
|
||||||
newObject.EmailConfirmCode = StringUtil.GenFetchCode();
|
newObject.EmailConfirmCode = StringUtil.GenFetchCode();
|
||||||
newObject.EmailValidated = false;
|
newObject.EmailValidated = false;
|
||||||
if (!importingDoNotNotify)
|
newObject.Status = TrialRequestStatus.AwaitingEmailValidation;
|
||||||
newObject.Status = TrialRequestStatus.AwaitingEmailValidation;
|
|
||||||
|
|
||||||
await ct.TrialLicenseRequest.AddAsync(newObject);
|
await ct.TrialLicenseRequest.AddAsync(newObject);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
@@ -63,37 +62,36 @@ namespace Sockeye.Biz
|
|||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
|
|
||||||
|
|
||||||
if (!importingDoNotNotify)
|
|
||||||
|
//## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ----------------
|
||||||
|
//ValidateEmail request message,RavenTrialApproved (which sends pending manual generation message) and RavenTrialRejected messages are sent in this block
|
||||||
|
//
|
||||||
|
//Send verification request
|
||||||
|
var verifyUrl = ServerGlobalOpsSettingsCache.Notify.SockeyeServerURL.Trim().TrimEnd('/') + $"/rvr/verify/{newObject.EmailConfirmCode}";
|
||||||
|
var body = ServerGlobalBizSettings.Cache.ValidateEmail.Replace("{verifyUrl}", verifyUrl);//$"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\nOnce your email is verified the request will be processed manually during business hours.\r\n(If you did not request this you can ignore this message)";
|
||||||
|
|
||||||
|
var notifyDirectSMTP = new Sockeye.Api.Controllers.NotifyController.NotifyDirectSMTP()
|
||||||
{
|
{
|
||||||
//## ------------------ DEFAULT NOTIFICATIONS TO CUSTOMER ----------------
|
ToAddress = newObject.Email,
|
||||||
//ValidateEmail request message,RavenTrialApproved (which sends pending manual generation message) and RavenTrialRejected messages are sent in this block
|
Subject = "AyaNova trial request email verification",
|
||||||
//
|
TextBody = body
|
||||||
//Send verification request
|
};
|
||||||
var verifyUrl = ServerGlobalOpsSettingsCache.Notify.SockeyeServerURL.Trim().TrimEnd('/') + $"/rvr/verify/{newObject.EmailConfirmCode}";
|
|
||||||
var body = ServerGlobalBizSettings.Cache.ValidateEmail.Replace("{verifyUrl}", verifyUrl);//$"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\nOnce your email is verified the request will be processed manually during business hours.\r\n(If you did not request this you can ignore this message)";
|
|
||||||
|
|
||||||
var notifyDirectSMTP = new Sockeye.Api.Controllers.NotifyController.NotifyDirectSMTP()
|
|
||||||
{
|
|
||||||
ToAddress = newObject.Email,
|
|
||||||
Subject = "AyaNova trial request email verification",
|
|
||||||
TextBody = body
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
|
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await m.SendEmailAsync(notifyDirectSMTP.ToAddress, notifyDirectSMTP.Subject, notifyDirectSMTP.TextBody, ServerGlobalOpsSettingsCache.Notify, null, null, null);
|
await m.SendEmailAsync(notifyDirectSMTP.ToAddress, notifyDirectSMTP.Subject, notifyDirectSMTP.TextBody, ServerGlobalOpsSettingsCache.Notify, null, null, null);
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, notifyDirectSMTP.ObjectId, notifyDirectSMTP.SockType, SockEvent.DirectSMTP, $"\"{notifyDirectSMTP.Subject}\"->{notifyDirectSMTP.ToAddress}"), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(1, notifyDirectSMTP.ObjectId, notifyDirectSMTP.SockType, SockEvent.DirectSMTP, $"\"{notifyDirectSMTP.Subject}\"->{notifyDirectSMTP.ToAddress}"), ct);
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var err = "TrialLicenseRequest sending email confirmation request: SMTP direct message failed";
|
|
||||||
await NotifyEventHelper.AddOpsProblemEvent(err, ex);
|
|
||||||
AddError(ApiErrorCode.API_SERVER_ERROR, null, err + ExceptionUtil.ExtractAllExceptionMessages(ex));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var err = "TrialLicenseRequest sending email confirmation request: SMTP direct message failed";
|
||||||
|
await NotifyEventHelper.AddOpsProblemEvent(err, ex);
|
||||||
|
AddError(ApiErrorCode.API_SERVER_ERROR, null, err + ExceptionUtil.ExtractAllExceptionMessages(ex));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
await HandlePotentialNotificationEvent(SockEvent.Created, newObject);
|
await HandlePotentialNotificationEvent(SockEvent.Created, newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
@@ -591,7 +589,7 @@ namespace Sockeye.Biz
|
|||||||
SockType = BizType,
|
SockType = BizType,
|
||||||
ObjectId = o.Id,
|
ObjectId = o.Id,
|
||||||
NotifySubscriptionId = sub.Id,
|
NotifySubscriptionId = sub.Id,
|
||||||
Name = $"{o.CompanyName} - trial license requested"
|
Name = o.CompanyName
|
||||||
};
|
};
|
||||||
await ct.NotifyEvent.AddAsync(n);
|
await ct.NotifyEvent.AddAsync(n);
|
||||||
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GenerateFullPaths>true</GenerateFullPaths>
|
<GenerateFullPaths>true</GenerateFullPaths>
|
||||||
<Version>8.0.0</Version>
|
<Version>8.0.3</Version>
|
||||||
<FileVersion>8.0.0.0</FileVersion>
|
<FileVersion>8.0.3.0</FileVersion>
|
||||||
<ApplicationIcon>sockeye.ico</ApplicationIcon>
|
<ApplicationIcon>sockeye.ico</ApplicationIcon>
|
||||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||||
<noWarn>1591</noWarn>
|
<noWarn>1591</noWarn>
|
||||||
|
|||||||
@@ -767,7 +767,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// 8.0.14 additions for job feedback
|
// 8.0.24 additions for job feedback
|
||||||
//
|
//
|
||||||
if (currentSchema < 8)
|
if (currentSchema < 8)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Sockeye.Util
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal static class SockeyeVersion
|
internal static class SockeyeVersion
|
||||||
{
|
{
|
||||||
public const string VersionString = "8.0.0";
|
public const string VersionString = "8.0.3";
|
||||||
public const string FullNameAndVersion = "Sockeye server " + VersionString;
|
public const string FullNameAndVersion = "Sockeye server " + VersionString;
|
||||||
public const string CurrentApiVersion="v8";
|
public const string CurrentApiVersion="v8";
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user