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.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)

View File

@@ -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

View File

@@ -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

View File

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