How do I password protect my Google App Engine app?

How would you implement simple password protection in the Google App Engine app? No user authentication, just enter a password to open a specific page. Another requirement is that the landing page should not be displayed if its URL is entered directly.

I am looking for a solution using Python.

+3
source share
2 answers

If you are protecting one page and do not need a persistent session.

class MainPage(webapp.RequestHandler):
    def post(self):
        if self.request.get('user') == 'admin' and self.request.get('pass') == 'soopersecure':
            self.response.out.write('authorized');
        else:
            self.response.out.write("""
<form method="post">
<input type="text" name="user"/>
<input type="password" name="pass"/>
<input type="submit" value="login"/>
</form>""")

+ cookie . Google.

http://code.google.com/appengine/docs/python/gettingstarted/usingusers.html

+5

, URL "login"

-

+1

Source: https://habr.com/ru/post/1766807/


All Articles