简体   繁体   English

如何使使用Parse登录的用户可以看到网页?

[英]How to make webpage viewable to users logged in with Parse?

I've built a homepage where users can login/register using parseSDK. 我建立了一个主页,用户可以使用parseSDK登录/注册。 That works at the moment. 目前,该方法有效。 The second page I've made is a dashboard (dashboard.html) which should be viewable to only users that login. 我制作的第二页是仪表板(dashboard.html),只有登录的用户才能看到。 At the moment, anyone can do ... http://mywebsite.com/dashboard.html and see the webpage. 目前,任何人都可以... http://mywebsite.com/dashboard.html并查看网页。

How can I set it up in such a way such that every time an user (not logged in at the time) goes to that URL, it will take them to index.html to login? 如何设置这种方式,以便每次用户(当时未登录)都访问该URL时,都会将他们带到index.html进行登录?

Check for Parse.User.current() in your javascript code. 检查您的JavaScript代码中的Parse.User.current() This gives you the details of current logged in user. 这为您提供了当前登录用户的详细信息。 You can redirect to index.html or dashboard.html accordingly. 您可以相应地重定向到index.html或dashboard.html。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM