1

Context: I have never work with Stormpath before and want to fully learn how to do certain stuff. To practice I'm creating my own portfolio, including the CMS.

My question is, how can I restrict the registration of accounts to a handful of specific emails using Google API (only me should be able to add and remove content from my own portfolio).

E.g. Allow ONLY example1@gmail.com and example2@gmail.com to register.

I could do it manually, but I do not want to do that. Steps I would like to follow are:

  1. Specify emails
  2. User tries to access the CMS
  3. User is prompted to login or register
  4. Only if user is in the specified list of emails, user can register using Google's API.

I do understand this is a very general question that involves several fields: Google's API, Stormpath, not to mention Express and Node, but maybe someone else solved this problem and I can see some code. Thanks.

4

1 回答 1

3

我是我假设您正在使用的 express-stormpath 库的作者。没有开箱即用的方法可以做到这一点,所以我想指出最好的方法:

现在,在现实世界中,您可能不想做这种事情(这是很多额外的工作,而且不会给您带来太多收益)。您可能想要做的是:完全禁用您网站上的帐户注册。这样,只有您可以使用https://stormpath.com上的 Stormpath 仪表板创建帐户,但登录仍然可以在您的站点上使用,以便您可以登录。

那有意义吗?

所以基本上,我的建议是您通过以下方式禁用您网站上的注册:

app.use(stormpath.init(app, {
  enableRegistration: false,  // this will disable the registration page / functionality
  // ...
}));

希望这会有所帮助=)

于 2015-04-13T16:46:23.533 回答