This commit is contained in:
@@ -101,7 +101,7 @@ namespace Sockeye.Api.Controllers
|
||||
TrialLicenseRequest o = await biz.CreateAsync(newObject);
|
||||
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);
|
||||
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
|
||||
@@ -124,7 +124,7 @@ namespace Sockeye.Api.Controllers
|
||||
|
||||
|
||||
//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)
|
||||
{
|
||||
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);
|
||||
var tlr = await biz.GetAsync(req.Id);
|
||||
if (tlr == null)
|
||||
|
||||
@@ -565,9 +565,10 @@ namespace Sockeye
|
||||
|
||||
if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
||||
{
|
||||
_newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
|
||||
Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
|
||||
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||
throw new InvalidOperationException("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - Sockeye must be erased via psql to protect data from accidental deletion");
|
||||
// _newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
|
||||
// Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
|
||||
// AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||
}
|
||||
|
||||
|
||||
@@ -663,12 +664,12 @@ namespace Sockeye
|
||||
Console.WriteLine("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
|
||||
|
||||
|
||||
if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
||||
{
|
||||
_newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - IMPORTING ROCKFISH");
|
||||
GlobalBizSettingsBiz.ImportRockfish(_newLog).Wait();
|
||||
_newLog.LogInformation("IMPORT COMPLETED");
|
||||
}
|
||||
// if (ServerBootConfig.SOCKEYE_PERMANENTLY_ERASE_DATABASE)
|
||||
// {
|
||||
// _newLog.LogWarning("SOCKEYE_PERMANENTLY_ERASE_DATABASE has been set - IMPORTING ROCKFISH");
|
||||
// GlobalBizSettingsBiz.ImportRockfish(_newLog).Wait();
|
||||
// _newLog.LogInformation("IMPORT COMPLETED");
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,7 @@ namespace Sockeye.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//CREATE
|
||||
//
|
||||
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject, bool importingDoNotNotify = false)
|
||||
internal async Task<TrialLicenseRequest> CreateAsync(TrialLicenseRequest newObject)
|
||||
{
|
||||
await ValidateAsync(newObject, null);
|
||||
if (HasErrors)
|
||||
@@ -53,8 +53,7 @@ namespace Sockeye.Biz
|
||||
//Process a new request / Generate an email confirm code
|
||||
newObject.EmailConfirmCode = StringUtil.GenFetchCode();
|
||||
newObject.EmailValidated = false;
|
||||
if (!importingDoNotNotify)
|
||||
newObject.Status = TrialRequestStatus.AwaitingEmailValidation;
|
||||
newObject.Status = TrialRequestStatus.AwaitingEmailValidation;
|
||||
|
||||
await ct.TrialLicenseRequest.AddAsync(newObject);
|
||||
await ct.SaveChangesAsync();
|
||||
@@ -63,37 +62,36 @@ namespace Sockeye.Biz
|
||||
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 ----------------
|
||||
//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()
|
||||
{
|
||||
ToAddress = newObject.Email,
|
||||
Subject = "AyaNova trial request email verification",
|
||||
TextBody = body
|
||||
};
|
||||
ToAddress = newObject.Email,
|
||||
Subject = "AyaNova trial request email verification",
|
||||
TextBody = body
|
||||
};
|
||||
|
||||
|
||||
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
IMailer m = Sockeye.Util.ServiceProviderProvider.Mailer;
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
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);
|
||||
return newObject;
|
||||
@@ -591,7 +589,7 @@ namespace Sockeye.Biz
|
||||
SockType = BizType,
|
||||
ObjectId = o.Id,
|
||||
NotifySubscriptionId = sub.Id,
|
||||
Name = $"{o.CompanyName} - trial license requested"
|
||||
Name = o.CompanyName
|
||||
};
|
||||
await ct.NotifyEvent.AddAsync(n);
|
||||
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateFullPaths>true</GenerateFullPaths>
|
||||
<Version>8.0.0</Version>
|
||||
<FileVersion>8.0.0.0</FileVersion>
|
||||
<Version>8.0.3</Version>
|
||||
<FileVersion>8.0.3.0</FileVersion>
|
||||
<ApplicationIcon>sockeye.ico</ApplicationIcon>
|
||||
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
|
||||
<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)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Sockeye.Util
|
||||
/// </summary>
|
||||
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 CurrentApiVersion="v8";
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user