Search code examples
node.jsexpressstormpath

disable stormpath's Create account option in the login screen


I want to disable the create account in the stormpath login screen. The call to the api should already be made from a user authenticated to the app. I tried setting stormpathEnableRegistration to false but the registration functionality is still enabled.

  app.use(stormpath.init(app, {
     apiKeyFile: config.stormpathapi.apiKeyFile,
     application: config.stormpathapi.application,
     secretKey: config.stormpathapi.secretKey,
     sessionDuration: 1000 * 60 * 30,
     enableAutoLogin: true,
     enableUsername: true,
     stormpathEnableRegistration: false
  }));

Thanks!


Solution

  • I'm the author of the express-stormpath library, sorry this was confusing.

    Here's what you need to do:

    1. Rename stormpathEnableRegistration -> enableRegistration.
    2. Update to the latest release of the library.

    I just pushed a change in the latest release which fixes a rendering issue on the login page when this setting is disabled. What used to be happening was this:

    • You'd disable registration.
    • The registration page wouldn't work.
    • But the login page would still render a 'Create Account' link.

    In the latest release this is fixed =)

    UPDATE: Since the 2.x.x release of express-stormpath is now out, the above information is no longer valid. Instead, you should do this:

    app.use(stormpath.init(app, {
      client: {
        apiKey: {
          file: config.stormpathapi.apiKeyFile
        }
      },
      application: {
        href: config.stormpathapi.application
      },
      web: {
        register: {
          enabled: false
        }
      }
    }));
    

    This will disable the registration functionality for you =)