This commit is contained in:
2020-06-12 19:45:53 +00:00
parent f66096e875
commit 490423a708
2 changed files with 17 additions and 12 deletions

View File

@@ -38,8 +38,10 @@ namespace rockfishCore.Controllers
#if (DEBUG) #if (DEBUG)
private const string LICENSE_SERVER_URL = "http://localhost:3001/"; private const string LICENSE_SERVER_URL = "http://localhost:3001/";
private const string SUPPORT_EMAIL = "cardjohn@ayanova.com";
#else #else
private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/"; private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";
private const string SUPPORT_EMAIL="support@ayanova.com";
#endif #endif
[HttpPost] [HttpPost]
@@ -80,15 +82,16 @@ namespace rockfishCore.Controllers
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
NewRequest.EmailConfirmCode = NewRequest.Id.ToString() + FetchKeyCode.generate(); NewRequest.EmailConfirmCode = NewRequest.Id.ToString() + FetchKeyCode.generate();
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
var verifyUrl = LICENSE_SERVER_URL + $"rvr/verify?code={NewRequest.EmailConfirmCode}"; var verifyUrl = LICENSE_SERVER_URL + $"rvr/verify/{NewRequest.EmailConfirmCode}";
var body = $"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\n(If you did not request this you can ignore this message)"; var body = $"Please verify your email address by clicking the link below or copy and pasting into a browser\r\n{verifyUrl}\r\n(If you did not request this you can ignore this message)";
//send confirmation email //send confirmation email
RfMail.SendMessage("support@ayanova.com", NewRequest.Email, "AyaNova trial request email verification", body, false); RfMail.SendMessage("support@ayanova.com", NewRequest.Email, "AyaNova trial request email verification", body, false);
return Ok(new { Accepted = true }); //return Ok(new { Accepted = true });
return Accepted();
} }
[HttpGet("verify")] [HttpGet("verify/{code}")]
public async Task<IActionResult> GetVerify([FromRoute] string code) public async Task<IActionResult> GetVerify([FromRoute] string code)
{ {
//is there a valid trial request //is there a valid trial request
@@ -108,7 +111,7 @@ namespace rockfishCore.Controllers
//notify *us* //notify *us*
//http://localhost:3001/default.htm#!/trials/[id] //http://localhost:3001/default.htm#!/trials/[id]
var rfUrl = LICENSE_SERVER_URL + $"default.htm#!/trials/{req.Id}"; var rfUrl = LICENSE_SERVER_URL + $"default.htm#!/trialEdit/{req.Id}";
var body = $"Email address {req.Email} was just verified for {req.ContactName} at {req.CompanyName}.\r\nTrial key is ready to be processed now:\r\n{rfUrl}"; var body = $"Email address {req.Email} was just verified for {req.ContactName} at {req.CompanyName}.\r\nTrial key is ready to be processed now:\r\n{rfUrl}";
//send confirmation email //send confirmation email
RfMail.SendMessage("support@ayanova.com", "support@ayanova.com", "AyaNova trial request requiring action", body, false); RfMail.SendMessage("support@ayanova.com", "support@ayanova.com", "AyaNova trial request requiring action", body, false);

View File

@@ -16,16 +16,18 @@ namespace rockfishCore.Models
public partial class TrialRequest public partial class TrialRequest
{ {
public enum TrialRequestStatus{ public enum TrialRequestStatus
NotSet=0, {
Approved=1, NotSet = 0,
Rejected=2 Approved = 1,
Rejected = 2
} }
public TrialRequest() public TrialRequest()
{ {
DtRequested=DateUtil.NowAsEpoch(); DtRequested = DateUtil.NowAsEpoch();
EmailValidated=false; EmailValidated = false;
Status=TrialRequestStatus.NotSet; Status = TrialRequestStatus.NotSet;
EmailConfirmCode = "?";
} }
public long Id { get; set; } public long Id { get; set; }
public Guid DbId { get; set; } public Guid DbId { get; set; }
@@ -33,7 +35,7 @@ namespace rockfishCore.Models
public string ContactName { get; set; } public string ContactName { get; set; }
public string Notes { get; set; } public string Notes { get; set; }
public string Email { get; set; } public string Email { get; set; }
public string EmailConfirmCode {get;set;} public string EmailConfirmCode { get; set; }
public bool EmailValidated { get; set; } public bool EmailValidated { get; set; }
public long? DtRequested { get; set; } public long? DtRequested { get; set; }
public long? DtProcessed { get; set; } public long? DtProcessed { get; set; }