def loginRequired(self): if users.get_current_user() is not None: function(self) else: loginUrl = users.create_login_url(dest_url=self.request.url) page = LoginPageTemplate({ 'login' : loginUrl }) return self.response.write( page.render() )
def loginPage(self): """ pagina di login, presenta la richiesta di login al visitatore """ login_url = users.create_login_url( dest_url=self.request.path) page = LoginPageTemplate({ 'login' : login_url }) return self.response.write( page.render() )
def get(self): user = users.get_current_user() if user is None: login_url = users.create_login_url( dest_url=self.request.path) page = LoginPageTemplate({ 'login' : login_url }) return self.response.write( page.render() ) userEmail = users.get_current_user().email() AllowedUser(email=userEmail, status = PENDING ).put() # pending logging.info("User %s messo in stato pendente " % userEmail ) page = VisitorWaitTemplate({'logout': users.create_logout_url("/") }) body = "Clicca per autorizzare : {0}/authorize?email={1}" \ .format( self.request.host_url, userEmail ) mail.send_mail( sender=ADMIN, to=ADMIN, subject="Nuova richiesta di autorizzazione", body=body ) logging.info( body ) return self.response.write( page.render())