License Key Plugin

7 年 前
To get this latest 3.50 version to work one has to make a few changes to the source code:

Routeprovider.cs: Add this mapping

            
routes.MapRoute("Plugin.Misc.Licenses.GetProductKey",
                 "Plugins/ProductKey/GetProductKey",
                 new { controller = "ProductKey", action = "GetProductKey" },
                 new[] { "Nop.Plugin.Misc.Licenses.Controllers" }
            );


ProductKeyConsumer.cs: Change one line in HandleEvent(...) to match:

  string url = "../../../Plugins/ProductKey/GetProductKey?productId=" + productId;


EditProductKey.cshtl: Add a 'using' at line 2

@using Nop.Web.Framework;


Maybe I'll find some other issues later.

DNF: Uninstall and install the plugin in the nop admin!
7 年 前
actOpus Thanks a lot.

My a little contribution.
I added a button for a generation LicenceKey

EditProductKey.cshtml


@model Nop.Plugin.Misc.Licenses.Models.ProductKeyModel
@using Nop.Web.Framework;

<table class="adminContent">
    <tr>
        <td class="adminTitle">
            @Html.NopLabelFor(model => model.ProductKey):
        </td>
        <td class="adminData">
            @Html.EditorFor(model => model.ProductKey)
            <span id="licensekey-generate" class="k-button">Generate</span>
            <span id="licensekey-save" class="k-button">@T("Admin.Common.Save")</span>
            <span id="licensekey-message" style="color:#009900"></span>
        </td>
    </tr>
</table>

<script type="text/javascript">
    $(document).ready(function () {
        $("#licensekey-save").click(function () {
            $("#licensekey-message").html("");
            var model = {id: $("#Id").val(), productKey: $("#ProductKey").val() };
            $.post("@(Url.RouteUrl("Plugin.Misc.Licenses.SaveKey"))", model, function() {
                $("#licensekey-message").html("@T("Nop.Plugin.Misc.LicenseKey.Saved")");
            });
        });
        $("#licensekey-generate").click(function () {
            $("#ProductKey").val(generateRandomKey(16));
        });
    });


    var generateRandomKey = function(length) {
        var chars = '!#^&*()0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        var result = '';
        for (var i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
        return result;
    }
</script>
7 年 前
Ah nice, I was using an online key generation tool but this is much easier
7 年 前
Hi there!

Have you changed it to support multistore license?

And after customer get the key, input it as plugin settings, how to verify it in destination plugin?

Thanks!
7 年 前
Does this plugin allow vendors to be able to have license keys assigned out and verified, or is it only a store owner?
7 年 前
Does anyone have a compiled version of this that works with 3.50 that they could post?

UPDATE: Nevermind, I got mine to compile correctly now.
7 年 前
Has anyone changed this plugin to work with trial versions of software? If so, would you mind supplying the code to do that?
7 年 前
So, we should have:

- trial keys;
- key use in multi-store;
- how to decrypt key in plugin configuration and check if it is valid when plugin is executed;
7 年 前
ivanslater wrote:
And after customer get the key, input it as plugin settings, how to verify it in destination plugin? Thanks!

Is this what you are looking for? http://bitshiftweb.com/verifying-a-license-key-in-your-plugins
7 年 前
Yes, it is, but this method should be in a core or main plugin, so all other can use it, otherwise all plugins should have same method and any change should be painful.

Right?