0
後,我設計用火力地堡一道數學題的網站,我想,當有人在日誌中顯示的問題。顯示文本登錄
我想在僞代碼是什麼,
if user logged in
document.write([problem])
else
document.write(Please login to see the problem)
任何想法?
後,我設計用火力地堡一道數學題的網站,我想,當有人在日誌中顯示的問題。顯示文本登錄
我想在僞代碼是什麼,
if user logged in
document.write([problem])
else
document.write(Please login to see the problem)
任何想法?
當使用火力地堡簡單登錄,於FirebaseAuthClient您的實例將定義被調用的任何時間的用戶更改登錄狀態的回調函數。
從https://www.firebase.com/docs/security/simple-login-overview.html:
var chatRef = new Firebase('https://SampleChat.firebaseIO-demo.com');
var authClient = new FirebaseAuthClient(chatRef, function(error, user) {
if (user) {
// user authenticated with Firebase
} else if (error) {
// an error occurred authenticating the user
} else {
// user is logged out
}
});
對於你的情況,如果你有一個用戶對象,你可以隱藏任何登錄相關的用戶界面,並顯示問題,否則,隱藏的問題,並顯示任何登錄相關的UI 。
然後,登錄用戶,選擇火力地堡簡單登錄認證供應商的一個或多個,配置在鍛造(通過https://<your-firebase>.firebaseio.com
訪問)該提供商,並嘗試通過對用戶進行認證:
authClient.login(<provider>, <options>);
希望這有幫助!
所以我應該寫的,'VAR chatRef =新的火力地堡( 'https://開頭 .firebaseIO-demo.com'); var authClient = new FirebaseAuthClient(chatRef,function(error,user){if(user){ } document.write(「Factor x^2 + 2x + 1」) } else if(error){ document.write (「登錄後再次嘗試。」) } else { document.write(「請登錄查看問題」) } });'是嗎? –
mathguy56
2013-02-19 15:48:57
@ShenalSanthush與火力地堡URL(somename.firebaseio.com),看起來不錯監測用戶認證狀態更換' .firebaseIO-demo.com'後。然後,一旦用戶點擊應用程序中的登錄按鈕,就調用'authClient.login(...)'。 –
2013-02-19 18:03:28
@ShenalSanthush要使用火力地堡簡單登錄看到電子郵件/密碼驗證的完整的示例,請參見[https://groups.google.com/forum/?hl=en_US&fromgroups=#!topic/firebase-talk/POcs7m5gihg](https: //groups.google.com/forum/?hl=en_US&fromgroups=#!topic/firebase-talk/POcs7m5gihg)。 – 2013-02-19 18:53:30