我正在使用meteor帐户进行登录和用户注册。
当用户点击底线(注册)时:
他被重定向到创建帐户页面:
这些页面背后的代码是jade模板和javascript的混合。
template(name="userFormsLayout")
section.auth-layout
section.auth-dialog
+Template.dynamic(template=content)
在点击注册链接时,似乎内容被替换了,据我所知,这是...
我想通过禁用注册页面上的最终注册按钮和/或禁用完整的注册页面来阻止用户创建新帐户。
我也愿意接受其他解决方案,以防止玩家注册。
相关: How can I set forbidClientAccountCreation to false in Meteor?
更新: 我也试过这个
AccountsTemplates.configure({
forbidClientAccountCreation: true
但得到了:
Error: signUp route configured but forbidClientAccountCreation set to true!
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:1)
我没有完整的答案,但我可以给你几件让你入门。
首先,您可以告诉AccountsTemplates(AT)使用您的布局。你可以把这个加载到客户端和服务器上的任何地方,例如LIB / atConfig:
AccountsTemplates.configureRoute('signIn', {
layoutTemplate: 'LoginLayout'
});
这是布局模板:
<template name="LoginLayout">
<main>
<div>
{{> Template.dynamic template=main}}
</div>
</main>
</template>
在JS中,您可以隐藏您不希望用户看到的模板位。在这里,我隐藏了密码表单和分隔符。您可以深入了解DOM以确定要隐藏的位:
Template.LoginLayout.onRendered(function() {
this.autorun(() => {
if (this.subscriptionsReady()) {
Tracker.afterFlush(() => {
$('.at-pwd-form').remove();
$('.at-sep').remove();
});
}
});
});
对于服务器,您可以检查新的用户尝试,如果使用用户名和密码,则拒绝它们。我认为这应该有效,但你可能不得不玩它:
import {Meteor} from 'meteor/meteor';
Meteor.startup(() => {
/**
* reject registration via username/password.
*/
Accounts.validateNewUser(function(attemptInfo) {
if (attemptInfo && attemptInfo.services && attemptInfo.services.password) {
return false;
}
return true;
});
});
答案 1 :(得分:1)
您的上一个错误来自向帐户设置发送有冲突的消息。您可能想要删除注册页面的route configuration吗?