frontend: Make signup/login/passwordreset/forgot forms submittable

Fixes #117
This commit is contained in:
Johannes Zellner 2019-03-02 20:37:35 +01:00
parent 9d6955b81e
commit b4790397c9
8 changed files with 86 additions and 66 deletions

View File

@ -17,16 +17,22 @@
<div class="auth-form-container">
<div class="auth-form">
<div class="form-title">
Reset your Password
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<button id="reset-button" class="button" onclick="window.commento.sendResetHex()">Send Reset Password Link</button>
<form onsubmit="window.commento.sendResetHex(event)">
<div class="form-title">
Reset your Password
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<button id="reset-button" class="button" type="submit">Send Reset Password Link</button>
</form>
<a class="link" href="[[[.Origin]]]/login">Suddenly remembered your password? Login.</a>
</div>
</div>

View File

@ -4,7 +4,9 @@
(document);
// Talks to the API and sends an reset email.
global.sendResetHex = function() {
global.sendResetHex = function(event) {
event.preventDefault();
var allOk = global.unfilledMark(["#email"], function(el) {
el.css("border-bottom", "1px solid red");
});

View File

@ -43,7 +43,9 @@
// Logs the user in and redirects to the dashboard.
global.login = function() {
global.login = function(event) {
event.preventDefault();
var allOk = global.unfilledMark(["#email", "#password"], function(el) {
el.css("border-bottom", "1px solid red");
});

View File

@ -1,7 +1,9 @@
(function (global, document) {
"use strict";
global.resetPassword = function() {
global.resetPassword = function(event) {
event.preventDefault();
var allOk = global.unfilledMark(["#password", "#password2"], function(el) {
el.css("border-bottom", "1px solid red");
});

View File

@ -4,7 +4,9 @@
// Signs up the user and redirects to either the login page or the email
// confirmation, depending on whether or not SMTP is configured in the
// backend.
global.signup = function() {
global.signup = function(event) {
event.preventDefault();
if ($("#password").val() !== $("#password2").val()) {
global.textSet("#err", "The two passwords don't match");
return;

View File

@ -25,24 +25,26 @@
<div class="auth-form-container">
<div class="auth-form">
<div class="form-title">
Login to continue
</div>
<form onsubmit="window.commento.login(event)">
<div class="form-title">
Login to continue
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="row">
<div class="label">Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="row">
<div class="label">Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<button id="button" class="button" onclick="window.commento.login()">Login</button>
<button id="button" class="button" type="submit">Login</button>
</form>
<a class="link" href="[[[.Origin]]]/forgot">Trouble logging in? Reset your password.</a>
<a class="link" href="[[[.Origin]]]/signup">Don't have an account yet? Sign up.</a>

View File

@ -17,23 +17,25 @@
<div class="auth-form-container">
<div class="auth-form">
<div class="form-title">
Reset your Password
</div>
<form onsubmit="window.commento.resetPassword(event)">
<div class="form-title">
Reset your Password
</div>
<div class="row">
<div class="label">New Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="row">
<div class="label">New Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="row">
<div class="label">Confirm Password</div>
<input class="input" type="password" name="password2" id="password2" placeholder="">
</div>
<div class="row">
<div class="label">Confirm Password</div>
<input class="input" type="password" name="password2" id="password2" placeholder="">
</div>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<button id="reset-button" class="button" onclick="window.commento.resetPassword()">Reset Password</button>
<div class="err" id="err"></div>
<div class="msg" id="msg"></div>
<button id="reset-button" class="button" type="submit">Reset Password</button>
</form>
</div>
</div>

View File

@ -24,38 +24,40 @@
<div class="auth-form-container">
<div class="auth-form">
<div class="form-title">
Create an account
</div>
<form onsubmit="window.commento.signup(event)">
<div class="form-title">
Create an account
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="row">
<div class="label">Email Address</div>
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
</div>
<div class="row">
<div class="label">Full Name</div>
<input class="input" type="text" name="name" id="name" placeholder="Full Name">
</div>
<div class="row">
<div class="label">Full Name</div>
<input class="input" type="text" name="name" id="name" placeholder="Full Name">
</div>
<div class="row">
<div class="label">Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="row">
<div class="label">Password</div>
<input class="input" type="password" name="password" id="password" placeholder="">
</div>
<div class="row">
<div class="label">Confirm Password</div>
<input class="input" type="password" name="password2" id="password2" placeholder="">
</div>
<div class="row">
<div class="label">Confirm Password</div>
<input class="input" type="password" name="password2" id="password2" placeholder="">
</div>
<input type="hidden" name="plan" id="plan" value="">
<input type="hidden" name="plan" id="plan" value="">
<div class="err" id="err"></div>
<div class="err" id="err"></div>
<p class="cent">
</p>
<p class="cent">
</p>
<button id="signup-button" class="button" onclick="window.commento.signup()">Sign up</button>
<button id="signup-button" class="button" type="submit">Sign up</button>
</form>
<a class="link" href="[[[.Origin]]]/login">Already have an account? Login instead.</a>
</div>