Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
data = self.update_profile(user, **vars)
else:
data = {"status": "error", "message": "undefined"}
if not "status" in data and data.get("errors"):
data.update(status="error", message="validation errors", code=401)
elif "errors" in data and not data["errors"]:
del data["errors"]
data["status"] = data.get("status", "success")
data["code"] = data.get("code", 200)
return data
elif path == "logout":
self.session["user"] = None
# Somehow call revoke for active plugin
elif path == "verify_email" and self.db:
if self.verify_email(get_vars.get("token")):
redirect(URL("auth", "email_verified"))
else:
redirect(URL("auth", "token_expired"))
env["path"] = path
return Template("auth.html").transform(env)
def abort_or_rediect(self, page):
"""
return HTTP 403 if content_type is applicaitons/json
else redirects to page"""
if request.content_type == "application/json":
abort(403)
redirect(URL(self.auth.route, page))
data = {"status": "error", "message": "undefined"}
if not "status" in data and data.get("errors"):
data.update(status="error", message="validation errors", code=401)
elif "errors" in data and not data["errors"]:
del data["errors"]
data["status"] = data.get("status", "success")
data["code"] = data.get("code", 200)
return data
elif path == "logout":
self.session["user"] = None
# Somehow call revoke for active plugin
elif path == "verify_email" and self.db:
if self.verify_email(get_vars.get("token")):
redirect(URL("auth", "email_verified"))
else:
redirect(URL("auth", "token_expired"))
env["path"] = path
return Template("auth.html").transform(env)
def index():
redirect(URL('static/index.html'))