This commit is contained in:
2020-06-18 23:34:27 +00:00
parent 288720ce8b
commit 1e87f9b077
4 changed files with 31 additions and 12 deletions

View File

@@ -131,23 +131,26 @@ namespace rockfishCore.Controllers
DBLicense.Code = "na"; DBLicense.Code = "na";
DBLicense.Key = Key; DBLicense.Key = Key;
DBLicense.RegTo = l.RegisteredTo; DBLicense.RegTo = l.RegisteredTo;
DBLicense.DtLicenseExpiration=l.LicenseExpirationDate; DBLicense.DtLicenseExpiration = l.LicenseExpirationDate;
DBLicense.DtMaintenanceExpiration=l.MaintenanceExpirationDate; DBLicense.DtMaintenanceExpiration = l.MaintenanceExpirationDate;
await ct.License.AddAsync(DBLicense); await ct.License.AddAsync(DBLicense);
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
//Key generated, record saved successfully //Key generated, record saved successfully
//inform customer and return no content //If key is not revoked (don't warn them in that case) send notification to customer
var body = $"Thank you for your purchase!\nYour AyaNova license key is ready to be installed.\nAyaNova will fetch it automatically within 24 hours or you can force it to fetch immediately from the License page in AyaNova now.\n---\n{newLicense}"; if (l.RegisteredTo != RavenKeyFactory.REVOKED_TOKEN)
//send license email {
var body = $"Thank you for your purchase!\nYour AyaNova license key is ready to be installed.\nAyaNova will fetch it automatically within 24 hours or you can force it to fetch immediately from the License page in AyaNova now.\n---\n{newLicense}";
//send license email
#if (DEBUG) #if (DEBUG)
RfMail.SendMessage("support@ayanova.com", "cardjohn@ayanova.com", "AyaNova license key", body, false); RfMail.SendMessage("support@ayanova.com", "cardjohn@ayanova.com", "AyaNova license key", body, false);
#else #else
throw new System.Exception("UNCOMMENT THIS FOR PRODUCTION"); throw new System.Exception("UNCOMMENT THIS FOR PRODUCTION");
// RfMail.SendMessage("support@ayanova.com", Customer.AdminEmail, "AyaNova license key", body, false); // RfMail.SendMessage("support@ayanova.com", Customer.AdminEmail, "AyaNova license key", body, false);
#endif #endif
}
return Ok("ok"); return Ok("ok");
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -19,7 +19,7 @@ namespace rockfishCore.Util
private const string UNLICENSED_TOKEN = "UNLICENSED"; private const string UNLICENSED_TOKEN = "UNLICENSED";
//REVOKED token //REVOKED token
private const string REVOKED_TOKEN = "REVOKED"; public const string REVOKED_TOKEN = "REVOKED";
//FEATURE NAMES //FEATURE NAMES
//Scheduleable users //Scheduleable users

View File

@@ -18,7 +18,8 @@ app.ravLicense = (function () {
var stateMap = {}, var stateMap = {},
configModule, configModule,
initModule, initModule,
onGenerate; onGenerate,
onRevoke;
//----------------- END MODULE SCOPE VARIABLES --------------- //----------------- END MODULE SCOPE VARIABLES ---------------
//------------------- BEGIN UTILITY METHODS ------------------ //------------------- BEGIN UTILITY METHODS ------------------
@@ -84,7 +85,10 @@ app.ravLicense = (function () {
$.gevent.publish("app-show-error", res.msg); $.gevent.publish("app-show-error", res.msg);
} else { } else {
page( page(
"#!/ravLicenses/" + stateMap.id + "/" + stateMap.context.params.cust_id "#!/ravLicenses/" +
stateMap.id +
"/" +
stateMap.context.params.cust_id
); );
return false; return false;
} }
@@ -93,6 +97,16 @@ app.ravLicense = (function () {
return false; //prevent default return false; //prevent default
}; };
onRevoke = function (event) {
event.preventDefault();
$("#registeredTo").val("REVOKED");
$("#licenseExpires").prop("checked", true);
var yesterday = moment().add(-1, "days").toISOString().substring(0, 10);
$('input[type="date"]').val(yesterday);
return false; //prevent default
};
// onSelectAllAddOns = function (event) { // onSelectAllAddOns = function (event) {
// event.preventDefault(); // event.preventDefault();
// $('#wbi').prop('checked', true); // $('#wbi').prop('checked', true);
@@ -192,6 +206,8 @@ app.ravLicense = (function () {
//var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10); //var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10);
//$('#lockoutDate').val(oneMonthFromNow); //$('#lockoutDate').val(oneMonthFromNow);
// bind actions
$("#btn-revoke").bind("click", onRevoke);
}; };
// return public methods // return public methods

View File

@@ -58,7 +58,7 @@
</div> </div>
<div class="app-frm-buttons"> <div class="app-frm-buttons">
<button id="btn-revoke" class="btn btn-warning">Revoke</button>
</div> </div>
</form> </form>
</div> </div>