Exemplo n.º 1
0
 def get(self):
   """ Serve the homepage. """
   user = users.get_current_user()
   self.response.out.write(template.render(
       'templates/index.html', {
         'user': user,
         'login_url': users.create_login_url(webapp2.uri_for('protected')),
         'logout_url': users.create_logout_url(webapp2.uri_for('home')),
         'password_forgot_url': users.create_password_forgot_url(
           webapp2.uri_for('protected')),
         'password_change_url': users.create_password_change_url(
           webapp2.uri_for('home'))
       }
     ))
Exemplo n.º 2
0
 def get(self):
   """ Restrict this page to logged in users only! """
   user = users.get_current_user()
   if not user:
     self.abort(401)
   else:
     self.response.out.write(template.render(
         'templates/protected-page.html', {
           'user': user,
           'logout_url': users.create_logout_url(webapp2.uri_for('home')),
           'password_change_url': users.create_password_change_url(
             webapp2.uri_for('protected'))
         }
       ))
Exemplo n.º 3
0
 def get(self):
   user = users.get_current_user()
   self.response.out.write(template.render(
     'templates/json-api-post-login-password-reset.html', {
       'user': user,
       'login_url': users.create_login_url(
         webapp2.uri_for('documentation')),
       'logout_url': users.create_logout_url(
         webapp2.uri_for('documentation')),
       'password_forgot_url': users.create_password_forgot_url(
         webapp2.uri_for('documentation')),
       'password_change_url': users.create_password_change_url(
         webapp2.uri_for('documentation'))
     }))
Exemplo n.º 4
0
 def get(self):
   """ Serves the JSON API page. """
   user = users.get_current_user()
   self.response.out.write(template.render(
     'templates/json-api.html', {
       'user': user,
       'login_url': users.create_login_url(
         webapp2.uri_for('documentation')),
       'logout_url': users.create_logout_url(
         webapp2.uri_for('documentation')),
       'password_forgot_url': users.create_password_forgot_url(
         webapp2.uri_for('documentation')),
       'password_change_url': users.create_password_change_url(
         webapp2.uri_for('documentation'))
     }))