2016-08-02 63 views
0

我是網站創建的新手,我使用登錄/成員身份功能。我如何在註冊後爲會員動態創建新的永久網頁(個人資料頁面)?動態創建成員頁面

//where I would use the code 


//Javascript 
firebase.auth().onAuthStateChanged(function(user) { 
    if (user) { 
    // User is signed in. 
    //Navigate to the User's page, which does not yet exist 
    var url = "http://example.com/" + user.uid; 
    window.location = url; 



    } else { 
// No user is signed in. 
} 
}); 
+1

您是使用CMS還是從頭開始編寫?到目前爲止,您嘗試過哪些代碼(或思考過程),以便我們看看? –

+0

我從頭開始寫這個。我使用Firebase作爲我的後端,只實現了非常簡單/註冊的代碼。 –

+0

如果您可以提供更多信息,這很有幫助。你的代碼到哪裏去了? – Joundill

回答

0

答案在文檔中。 https://firebase.google.com/docs/auth/web/manage-users#get_a_users_profile

我建議有一些火力文件的讀,你可能需要了解(你使用它假定服務器)如​​何火力路由工作

然而,對於你的要求(即用戶個人資料頁面),您只需抓取數據並將其顯示在常規個人資料網址中即可。

var user = firebase.auth().currentUser; 
var name, email, photoUrl, uid; 

if (user != null) { 
    name = user.displayName; 
    email = user.email; 
    photoUrl = user.photoURL; 
    uid = user.uid; // The user's ID, unique to the Firebase project. Do NOT use 
        // this value to authenticate with your backend server, if 
        // you have one. Use User.getToken() instead. 
}