2016-08-02 74 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. 
}