ログインプロセスを機能させようとしています。基本的に、ユーザーがログインしていない場合、すべてのルートは「/login」にリダイレクトされます。「/signup」と「/reset」を除くすべて。そこに行くと明らかにログインしないためです。
Router.configure({
layoutTemplate: 'layout'
});
Router.onBeforeAction(function () {
except: ['signup','reset']
if (!Meteor.userId()) {
// if the user is not logged in, render the Login template
this.render('login');
}
else {
this.next();
}
});
Router.route('/', function (){
this.render('app-main-page');
});
Router.route('/signup', function () {
this.render('signup');},
{
name:'signup'
});
Router.route('/reset', function () {
this.render('reset');},
{
name:'reset'
});
// and a bunch of more routes within the app
});
一般に、誰かがログイン テンプレートにログインしていない場合、onBeforeAction が機能しています。ただし、「除外」部分が機能していません。つまり、ユーザーはログイン ページにリダイレクトされるため、サインアップできません。誰にも洞察がありますか?非常に単純なコードのように見えますが、どこでエラーを起こしたのかまったくわかりません。