示例#1
0
 def get(self):
     values = {'logout_url': users.create_logout_url("/"),
               'app_vars': env_vars(),
               'time_zones': tz_list()}
     if users.is_current_user_admin():  # secure the page only admin can access
         display_admin(self, values)
     else:
         self.abort(401)
示例#2
0
    def get(self):
        user = users.get_current_user()
        if not user:
            self.abort(401)  # TODO: self.redirect doesn't work look into it
        uid = user.user_id()
        crud = ProfileCrud(uid)

        # If no profile send them to complete it otherwise route them back to home
        # TODO: Expose the update functionality it is already in place
        if not crud.profile():
            values = {'user': user,
                      'profile': crud.profile(),
                      'app_vars': env_vars(),
                      'time_zones': tz_list()}
            profile_view(self, values)
        else:
            crud.update_ip(self.request.remote_addr)
            self.redirect('/')
示例#3
0
    def get(self):
        user = users.get_current_user()
        if not user:
            self.abort(401)  # TODO: self.redirect doesn't work look into it
        uid = user.user_id()
        crud = ProfileCrud(uid)

        # If no profile send them to complete it otherwise route them back to home
        # TODO: Expose the update functionality it is already in place
        if not crud.profile():
            values = {
                'user': user,
                'profile': crud.profile(),
                'app_vars': env_vars(),
                'time_zones': tz_list()
            }
            profile_view(self, values)
        else:
            crud.update_ip(self.request.remote_addr)
            self.redirect('/')