2012-10-26 29 views
3

我剛開始玩流星。它看起來很棒。我想從賬戶的UI定製註冊過程:如何操作流星中的註冊過程?

  1. 讓用戶註冊(他們的生日)
  2. 時輸入額外的數據,他們登記後告訴他們另一個模式/頁爲他們進入更多位數據。

我該怎麼做?

回答

3

或者你應該使用「meteor add accounts-password」,那麼你可以使用Accounts.api來進行你自己的註冊過程。

http://docs.meteor.com/#accounts_createuser

讓你的形式,你的需要,那麼用什麼辦法來形式的數據傳遞給

Accounts.createUser(options, [callback]) 

var options = { 
    username: $('#input-username').val(), 
    password: $('#input-password').val(), 
    profiles: { 
     birthday: $('#input-birthday').val 
    } 
}; 
Accounts.createUser(options) 
+0

Searchend&found。謝謝。 – TJR

0

如果使用Accounts.createUser你可以存儲這樣的配置文件下的其他數據。

Meteor.methods({ 
'createUser': function(firstname, lastname, username, twitter, email, password, role){ 
    Accounts.createUser({ 

     email: email, 
     password: password, 
     username: username, 
     profile: { 
      firstname: firstname, 
      lastname: lastname, 
      twitter: twitter, 
      birthdate: birthdate 
     } 
    }); 
}, 

如果你想要第二個表單,你可以將用戶路由到它。

Template.registerUser.events({ 
    'submit form': function(event){ 
     event.preventDefault(); 
     var firstname = event.target.firstnam.value; 
     ... 

     Meteor.call('createUser', clubName, capacity, description, homepage); 
     Router.go('userInfoStep2'); 
    } 
}); 

我想你也可以在路由文件中做重定向。

這是一個簡單的解決方案,當用戶中斷註冊過程時不處理案例。但也許別人可以幫助嗎?