diff --git a/Controllers/RvlController.cs b/Controllers/RvlController.cs index 7a0f2ae..c64ad26 100644 --- a/Controllers/RvlController.cs +++ b/Controllers/RvlController.cs @@ -131,23 +131,26 @@ namespace rockfishCore.Controllers DBLicense.Code = "na"; DBLicense.Key = Key; DBLicense.RegTo = l.RegisteredTo; - DBLicense.DtLicenseExpiration=l.LicenseExpirationDate; - DBLicense.DtMaintenanceExpiration=l.MaintenanceExpirationDate; + DBLicense.DtLicenseExpiration = l.LicenseExpirationDate; + DBLicense.DtMaintenanceExpiration = l.MaintenanceExpirationDate; await ct.License.AddAsync(DBLicense); await ct.SaveChangesAsync(); //Key generated, record saved successfully - //inform customer and return no content - 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 key is not revoked (don't warn them in that case) send notification to customer + if (l.RegisteredTo != RavenKeyFactory.REVOKED_TOKEN) + { + + 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) - 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 throw new System.Exception("UNCOMMENT THIS FOR PRODUCTION"); // RfMail.SendMessage("support@ayanova.com", Customer.AdminEmail, "AyaNova license key", body, false); #endif - + } return Ok("ok"); } catch (Exception ex) diff --git a/util/RavenKeyFactory.cs b/util/RavenKeyFactory.cs index fd5d438..cb0a211 100644 --- a/util/RavenKeyFactory.cs +++ b/util/RavenKeyFactory.cs @@ -19,7 +19,7 @@ namespace rockfishCore.Util private const string UNLICENSED_TOKEN = "UNLICENSED"; //REVOKED token - private const string REVOKED_TOKEN = "REVOKED"; + public const string REVOKED_TOKEN = "REVOKED"; //FEATURE NAMES //Scheduleable users diff --git a/wwwroot/js/app.ravLicense.js b/wwwroot/js/app.ravLicense.js index 0f22f6a..1b6ced3 100644 --- a/wwwroot/js/app.ravLicense.js +++ b/wwwroot/js/app.ravLicense.js @@ -18,7 +18,8 @@ app.ravLicense = (function () { var stateMap = {}, configModule, initModule, - onGenerate; + onGenerate, + onRevoke; //----------------- END MODULE SCOPE VARIABLES --------------- //------------------- BEGIN UTILITY METHODS ------------------ @@ -84,7 +85,10 @@ app.ravLicense = (function () { $.gevent.publish("app-show-error", res.msg); } else { page( - "#!/ravLicenses/" + stateMap.id + "/" + stateMap.context.params.cust_id + "#!/ravLicenses/" + + stateMap.id + + "/" + + stateMap.context.params.cust_id ); return false; } @@ -93,6 +97,16 @@ app.ravLicense = (function () { 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) { // event.preventDefault(); // $('#wbi').prop('checked', true); @@ -192,6 +206,8 @@ app.ravLicense = (function () { //var oneMonthFromNow = moment().add(1, 'months').toISOString().substring(0, 10); //$('#lockoutDate').val(oneMonthFromNow); + // bind actions + $("#btn-revoke").bind("click", onRevoke); }; // return public methods diff --git a/wwwroot/js/templates/app.ravLicense.handlebars b/wwwroot/js/templates/app.ravLicense.handlebars index c837487..87fc21a 100644 --- a/wwwroot/js/templates/app.ravLicense.handlebars +++ b/wwwroot/js/templates/app.ravLicense.handlebars @@ -53,12 +53,12 @@ - +
- +
\ No newline at end of file