MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / signup

Function signup

main.py:461–480  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459
460@app.route("/signup")
461def signup():
462 email = request.args.get("email", None)
463 password = request.args.get("password", None)
464 confirm = request.args.get("confirm", None)
465
466 if not email or not password or not confirm:
467 return make_response(json.dumps({"status": "error", "error": "missing_field"}))
468
469 if not re.findall("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", email):
470 return make_response(json.dumps({"status": "error", "error": "invalid_email"}))
471
472 if password != confirm:
473 return make_response(json.dumps({"status": "error", "error": "passwords_dont_match"}))
474
475 id = users.insert({
476 "email": email,
477 "password": password,
478 })
479
480 session["user_id"] = str(id)
481
482
483@app.route("/<language>/progress")

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected