我想使用AutoForm創建一個註冊表單,其中後續創建用戶。 Furtehremore,新用戶註冊後應自動登錄。如何使用AutoForm註冊用戶並登錄?
因此,我創建了一個自動窗體和提供的meteormethod
稱爲signUp
:
Meteor.methods({
signUp: function (doc) {
check(doc, Schema.signUp);
Accounts.createUser({username: doc.username, password: doc.password});
}
});
這完美的作品。但是,我不知道如何從服務器端登錄用戶?這甚至有可能嗎?
如果不是,我該如何解決這個問題?我需要在我的Schema custom
驗證功能中包含Accounts.createUser({username: doc.username, password: doc.password});
嗎?
查看Atmosphere上的useraccounts包。這可能是你想要的,雖然不是這個問題的答案 –
也不要把'Accounts.createUser'放在'custom'驗證函數中。你能解釋一下你的方法沒有登錄你的問題嗎?在服務器端登錄某人意味着什麼?哪個客戶端登錄? –