在登录屏幕中禁用stormpath的"创建帐户"选项

Wil*_*pez 5 node.js express stormpath

我想在stormpath登录屏幕中禁用创建帐户.应该已经通过对应用程序进行身份验证的用户调用api.我尝试将stormpathEnableRegistration设置为false,但仍启用了注册功能.

  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
  }));
Run Code Online (Sandbox Code Playgroud)

谢谢!

rde*_*ges 6

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
    }
  }
}));
Run Code Online (Sandbox Code Playgroud)

这将禁用您的注册功能=)