Encrypt password filed on the login and register page

Plugin Development

Suggested Topics


  • 0 Votes
    1 Posts
    165 Views

    Hi,

    How to require local utilities in my acpScript properly? I want to separate functions in my acpScript of my plugin into several JS files. My acpScipt is located at path public/lib/admin/index.js with codes:

    'use strict'; /* globals socket, define, require */ define( 'admin/plugins/myPlugin', [ 'myAdminUtilities' ], function (util) { const Admin = {}; Admin.init = function () { socket.emit( 'plugins.myPlugin.getData', myAdminUtilities.handleResponse, ); }; return Admin; } );

    Then, file myAdminUtilities is located at path public/lib/admin/utils.js with codes:

    define('admin/plugins/myAdminUtilities', function () { const adminUtils = {}; adminUtils.handleResponse = function (error, data) { // process data ... }; return adminUtils; });

    Also, I have modified my plugin.json with following:

    { ... "modules": { "myAdminUtilities": "public/lib/admin/utils.js" }, ... }

    But, I get get admin/plugins/myAdminUtilities (404 Not found) every time I enter my plugin ACP page. What's the proper way to reach my goal?

  • Use Template Files

    Plugin Development
    0 Votes
    3 Posts
    1k Views

    Output:

    27/3 16:06 [5426] - info: NodeBB is now listening on: 0.0.0.0:4567 27/3 16:06 [5426] - error: TypeError: Cannot read property '@index' of undefined at helpers.displayMenuItem (/root/NodeBB/public/src/modules/helpers.js:13:29) at checkConditionalHelpers (/root/NodeBB/node_modules/templates.js/lib/templates.js:269:76) at parse (/root/NodeBB/node_modules/templates.js/lib/templates.js:424:15) at parseTemplate (/root/NodeBB/node_modules/templates.js/lib/templates.js:133:14) at Object.templates.parse (/root/NodeBB/node_modules/templates.js/lib/templates.js:119:11) at /root/NodeBB/node_modules/templates.js/lib/templates.js:169:30 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3) TypeError: Cannot read property '@index' of undefined at helpers.displayMenuItem (/root/NodeBB/public/src/modules/helpers.js:13:29) at checkConditionalHelpers (/root/NodeBB/node_modules/templates.js/lib/templates.js:269:76) at parse (/root/NodeBB/node_modules/templates.js/lib/templates.js:424:15) at parseTemplate (/root/NodeBB/node_modules/templates.js/lib/templates.js:133:14) at Object.templates.parse (/root/NodeBB/node_modules/templates.js/lib/templates.js:119:11) at /root/NodeBB/node_modules/templates.js/lib/templates.js:169:30 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3) 27/3 16:06 [5426] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised. 27/3 16:06 [5426] - info: [app] Database connection closed. 27/3 16:06 [5426] - info: [app] Web server closed to connections. 27/3 16:06 [5426] - info: [app] Shutdown complete. 27/3 16:06 [5460] - info: Time: Sun Mar 27 2016 16:06:43 GMT+0200 (CEST) 27/3 16:06 [5460] - info: Initializing NodeBB v1.0.2

    //

  • 0 Votes
    1 Posts
    1k Views

    Suppose to be in my controller.js and I need to redirect user on the user page.

    ...
    var username=user//it's the username
    res.render('/user/'+username);

    but I obtain an error :

    Object #<IncomingMessage> has no method 'csrfToken'

    "/vagrant/nodebb/public/templates"

    Anyone can help me?

  • 0 Votes
    3 Posts
    1k Views

    Ooops! I'm sorry haha, this headache is giving me coding troubles. Thanks!

  • 0 Votes
    1 Posts
    945 Views

    Hi! I'm trying to make another SSO plugin, but the difference is: i want user to fill missing fields (like email) after external authentication but before user is created in the forum.

    The only good solution i see is to override successReturnToOrRedirect andfailureRedirect fields to custom routes (https://github.com/NodeBB/NodeBB/blob/master/src/routes/authentication.js#L60), which are handled by plugin itself, to render input forms and logic. So i think it would be nice to extend login strategy with success/fail routes and use them if specified.

    I would like to hear opinion about my idea. If it is good enough i think i can create pull request.