def user_view():
"""
User interface (only shows the token).
:return: An http response with the submitted information.
"""
user = users.get_current_user()
if not user:
return redirect(users.create_login_url("/user"))
email = user.email()
doctors = tesis_bd.Doctor.query(tesis_bd.Doctor.email == email).fetch()
if len(doctors) == 0:
return render_template('error.html', message="User not found in the DB.")
doctor = doctors[0]
name = doctor.name
if not doctor.token:
doctor.token = "%016x" % random.getrandbits(64)
code = doctor.token
doctor.put()
logout_url = users.create_logout_url("/")
return render_template('user_view.html', login=doctor.name, name=name, email=email, code=code,
logout_url=logout_url)
评论列表
文章目录