New registration page (#1)
* Registration page * Fix registration pages and serve static files Co-authored-by: Giuseppe Del Campo <52317197+Giuseppetm@users.noreply.github.com>
This commit is contained in:
parent
70d158712a
commit
fc3be95e0b
6 changed files with 172 additions and 25 deletions
9
main.py
9
main.py
|
@ -2,7 +2,7 @@ import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from flask import Flask, render_template, Response, request
|
from flask import Flask, render_template, Response, request, send_from_directory
|
||||||
|
|
||||||
import overleaf
|
import overleaf
|
||||||
|
|
||||||
|
@ -37,6 +37,11 @@ def index() -> Response:
|
||||||
|
|
||||||
ol = overleaf.Overleaf(os.environ.get("OL_INSTANCE"))
|
ol = overleaf.Overleaf(os.environ.get("OL_INSTANCE"))
|
||||||
ol.login(os.environ.get("OL_ADMIN_EMAIL"), os.environ.get("OL_ADMIN_PASSWORD"))
|
ol.login(os.environ.get("OL_ADMIN_EMAIL"), os.environ.get("OL_ADMIN_PASSWORD"))
|
||||||
ol.register_user(email)
|
# ol.register_user(email)
|
||||||
ol.logout()
|
ol.logout()
|
||||||
return render_template("done.html", submitted_email=email)
|
return render_template("done.html", submitted_email=email)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/register/static/<path:path>", methods=["GET"])
|
||||||
|
def serve_static_files(path) -> Response:
|
||||||
|
return send_from_directory("static", path)
|
||||||
|
|
5
static/scripts/scripts.js
Normal file
5
static/scripts/scripts.js
Normal file
File diff suppressed because one or more lines are too long
5
static/styles/styles.css
Normal file
5
static/styles/styles.css
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,49 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Overleaf registration: done</title>
|
<title>Overleaf registration: done</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/register/static/styles/styles.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Done!</h1>
|
<nav class="navbar navbar-default navbar-main">
|
||||||
Please check your email (<b>{{ submitted_email }}</b>) and click on the link to confirm your account.
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header"><button class="navbar-toggle" ng-init="navCollapsed = true"
|
||||||
|
ng-click="navCollapsed = !navCollapsed" ng-class="{active: !navCollapsed}"
|
||||||
|
aria-label="Toggle Navigation" _msthidden="A" _msthiddenattr="555568" _mstaria-label="314691"><i
|
||||||
|
class="fa fa-bars" aria-hidden="true"></i></button><a class="navbar-title" href="/"
|
||||||
|
aria-label="Overleaf StudentiUniMi" ng-non-bindable="" _mstaria-label="473811" _msthash="626730"
|
||||||
|
_msttexthash="473811" style="text-align: left;">Overleaf StudentiUniMi</a></div>
|
||||||
|
<div class="navbar-collapse collapse" collapse="navCollapsed" style="height: 0px;">
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="/register" _msthash="1056250" _msttexthash="117676">Register</a></li>
|
||||||
|
<li><a href="/login" _msthash="1056251" _msttexthash="71604">Login</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="content content-alt">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 _msthash="1612143" _msttexthash="71604" style="text-align: left;">StudentiUniMi Overleaf
|
||||||
|
registration</h1>
|
||||||
|
<div class="alert alert-success">
|
||||||
|
<p>Done! Please check your email (<b>{{ submitted_email }}</b>) and click on the link to confirm your account.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a href="/login">
|
||||||
|
<button class="btn btn-info">Login</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="/register/static/scripts/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,9 +1,48 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>Overleaf registration: done</title>
|
<title>Overleaf registration: done</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/register/static/styles/styles.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Error: {{ error }}</h1>
|
<nav class="navbar navbar-default navbar-main">
|
||||||
Please retry on the <a href="/register">previous page</a>.
|
<div class="container-fluid">
|
||||||
|
<div class="navbar-header"><button class="navbar-toggle" ng-init="navCollapsed = true"
|
||||||
|
ng-click="navCollapsed = !navCollapsed" ng-class="{active: !navCollapsed}"
|
||||||
|
aria-label="Toggle Navigation" _msthidden="A" _msthiddenattr="555568" _mstaria-label="314691"><i
|
||||||
|
class="fa fa-bars" aria-hidden="true"></i></button><a class="navbar-title" href="/"
|
||||||
|
aria-label="Overleaf StudentiUniMi" ng-non-bindable="" _mstaria-label="473811" _msthash="626730"
|
||||||
|
_msttexthash="473811" style="text-align: left;">Overleaf StudentiUniMi</a></div>
|
||||||
|
<div class="navbar-collapse collapse" collapse="navCollapsed" style="height: 0px;">
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li><a href="/register" _msthash="1056250" _msttexthash="117676">Register</a></li>
|
||||||
|
<li><a href="/login" _msthash="1056251" _msttexthash="71604">Login</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="content content-alt">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 _msthash="1612143" _msttexthash="71604" style="text-align: left;">StudentiUniMi Overleaf
|
||||||
|
registration</h1>
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<p>Error: {{ error }}</p>
|
||||||
|
</div>
|
||||||
|
<a href="/register">
|
||||||
|
<button class="btn btn-info">Retry</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="/register/static/scripts/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -1,29 +1,82 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>StudentiUniMi Overleaf registration</title>
|
<title>StudentiUniMi Overleaf registration</title>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="/register/static/styles/styles.css">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>StudentiUniMi Overleaf registration</h1>
|
<nav class="navbar navbar-default navbar-main">
|
||||||
|
<div class="container-fluid">
|
||||||
<form id="registration-form" method="POST" action="/register">
|
<div class="navbar-header"><button class="navbar-toggle" ng-init="navCollapsed = true"
|
||||||
<label for="email-input">Email</label>
|
ng-click="navCollapsed = !navCollapsed" ng-class="{active: !navCollapsed}"
|
||||||
<input id="email-input" name="email" type="email" />
|
aria-label="Toggle Navigation" _msthidden="A" _msthiddenattr="555568" _mstaria-label="314691"><i
|
||||||
|
class="fa fa-bars" aria-hidden="true"></i></button><a class="navbar-title" href="/"
|
||||||
<br />
|
aria-label="Overleaf StudentiUniMi" ng-non-bindable="" _mstaria-label="473811" _msthash="626730"
|
||||||
We suggest you to use your @studenti.unimi.it or @unimi.it email.
|
_msttexthash="473811" style="text-align: left;">Overleaf StudentiUniMi</a></div>
|
||||||
|
<div class="navbar-collapse collapse" collapse="navCollapsed" style="height: 0px;">
|
||||||
<br />
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<button class="g-recaptcha"
|
<li><a href="/register" _msthash="1056250" _msttexthash="117676">Register</a></li>
|
||||||
data-sitekey="{{ CAPTCHA_CLIENT_KEY }}"
|
<li><a href="/login" _msthash="1056251" _msttexthash="71604">Login</a></li>
|
||||||
data-callback="onSubmit"
|
</ul>
|
||||||
data-action="submit">Submit</button>
|
</div>
|
||||||
</form>
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="content content-alt">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
|
||||||
|
<div class="card">
|
||||||
|
<div class="page-header">
|
||||||
|
<h1 _msthash="1612143" _msttexthash="71604" style="text-align: left;">StudentiUniMi Overleaf
|
||||||
|
registration</h1>
|
||||||
|
<p>We suggest you to use your @studenti.unimi.it or @unimi.it email.</p>
|
||||||
|
</div>
|
||||||
|
<form async-form="login" name="loginForm" action="/register" method="POST"
|
||||||
|
class="ng-pristine ng-valid-email ng-invalid ng-invalid-required"
|
||||||
|
id="registration-form">
|
||||||
|
<form-messages for="loginForm" class="ng-isolate-scope">
|
||||||
|
<div class="alert ng-binding ng-hide alert-success" ng-class="{
|
||||||
|
'alert-danger': form.response.message.type == 'error',
|
||||||
|
'alert-success': form.response.message.type != 'error'
|
||||||
|
}" ng-show="!!form.response.message" ng-bind-html="form.response.message.text"></div>
|
||||||
|
<div ng-transclude=""></div>
|
||||||
|
</form-messages>
|
||||||
|
<div class="form-group"><input
|
||||||
|
class="form-control ng-pristine ng-isolate-scope ng-empty ng-valid-email ng-invalid ng-invalid-required ng-touched"
|
||||||
|
type="email" name="email" required="" placeholder="your.email@studenti.unimi.it"
|
||||||
|
ng-model="email" ng-model-options="{ updateOn: 'blur' }" focus="true"
|
||||||
|
_mstplaceholder="329745" style="text-align: left;"><span
|
||||||
|
class="small text-primary ng-hide"
|
||||||
|
ng-show="loginForm.email.$invalid && loginForm.email.$dirty"
|
||||||
|
_msthash="2219269" _msttexthash="451906" _msthidden="1">Must be an email
|
||||||
|
address</span></div>
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn-primary btn g-recaptcha" type="submit" ng-disabled="loginForm.inflight"
|
||||||
|
data-sitekey="{{ CAPTCHA_CLIENT_KEY }}" data-callback="onSubmit"
|
||||||
|
data-action="submit">
|
||||||
|
<span ng-show="!loginForm.inflight" _msthash="2371122" _msttexthash="94068">
|
||||||
|
Register
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script src="/register/static/scripts/scripts.js"></script>
|
||||||
|
|
||||||
<script src="https://www.google.com/recaptcha/api.js"></script>
|
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function onSubmit(token) {
|
function onSubmit(token) {
|
||||||
document.getElementById("registration-form").submit();
|
document.getElementById("registration-form").submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue