Пример #1
0
 def verify_service(service, code):
     p = get_object_or_404(PublicId, PublicId.idtype == service, PublicId.code == code)
     if p.code_expored_date < datetime.now():
         p.refresh_code()
         p = p.update_obj()
         p.resend_code()
         raise ValueError("Code expired")
     p.accept_veiry()
     Response(json.dumps({"status": "ok"}, default=json_serial), status=200, mimetype="application/json")
Пример #2
0
 def get():
     account, service = request.form.get('account'), request.form.get('service')
     if not account:
         account, service = request.json.get('account'), request.json.get('service')
     publicid = get_object_or_404(PublicId, PublicId.account == account, PublicId.idtype == service)
     return Response(json.dumps({"key": publicid.key.first().publickey}, default=json_serial), status=200, mimetype="application/json")