Пример #1
0
    def get(self):
        name = self.get_cookie('username')
        friends = None
        template_values = {}

        if name:
            user = User.get_user(name)
            if user and Authentication.valid_log_token(user.username_norm, user.log_token):
                friends = user.get_friends()
                template_values = {'title' : self.get_title(), 'username': name, 'friends': friends}
            else:
                self.redirect('/logout')

        self.render("index.html", template_values)
Пример #2
0
    def get(self):
        name = self.get_cookie('username')
        friends = None
        template_values = {}

        if name:
            user = User.get_user(name)
            if user and Authentication.valid_log_token(user.username_norm,
                                                       user.log_token):
                friends = user.get_friends()
                template_values = {
                    'title': self.get_title(),
                    'username': name,
                    'friends': friends
                }
            else:
                self.redirect('/logout')

        self.render("index.html", template_values)
Пример #3
0
def is_authenticated():
    username = webapp2.get_request().cookies.get("username")
    log_token = webapp2.get_request().cookies.get("log_token")

    return Authentication.valid_log_token(username, log_token) or False
Пример #4
0
def is_authenticated():
    username  = webapp2.get_request().cookies.get("username")
    log_token = webapp2.get_request().cookies.get("log_token")

    return Authentication.valid_log_token(username, log_token) or False