| 459 | |
| 460 | @app.route("/signup") |
| 461 | def 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") |