frontend: Make signup/login/passwordreset/forgot forms submittable
Fixes #117
This commit is contained in:
parent
9d6955b81e
commit
b4790397c9
@ -17,16 +17,22 @@
|
|||||||
|
|
||||||
<div class="auth-form-container">
|
<div class="auth-form-container">
|
||||||
<div class="auth-form">
|
<div class="auth-form">
|
||||||
|
<form onsubmit="window.commento.sendResetHex(event)">
|
||||||
<div class="form-title">
|
<div class="form-title">
|
||||||
Reset your Password
|
Reset your Password
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="label">Email Address</div>
|
<div class="label">Email Address</div>
|
||||||
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
|
<input class="input" type="text" name="email" id="email" placeholder="example@example.com">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="err" id="err"></div>
|
<div class="err" id="err"></div>
|
||||||
<div class="msg" id="msg"></div>
|
<div class="msg" id="msg"></div>
|
||||||
<button id="reset-button" class="button" onclick="window.commento.sendResetHex()">Send Reset Password Link</button>
|
|
||||||
|
<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>
|
<a class="link" href="[[[.Origin]]]/login">Suddenly remembered your password? Login.</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
(document);
|
(document);
|
||||||
|
|
||||||
// Talks to the API and sends an reset email.
|
// 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) {
|
var allOk = global.unfilledMark(["#email"], function(el) {
|
||||||
el.css("border-bottom", "1px solid red");
|
el.css("border-bottom", "1px solid red");
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,9 @@
|
|||||||
|
|
||||||
|
|
||||||
// Logs the user in and redirects to the dashboard.
|
// 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) {
|
var allOk = global.unfilledMark(["#email", "#password"], function(el) {
|
||||||
el.css("border-bottom", "1px solid red");
|
el.css("border-bottom", "1px solid red");
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
(function (global, document) {
|
(function (global, document) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
global.resetPassword = function() {
|
global.resetPassword = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
var allOk = global.unfilledMark(["#password", "#password2"], function(el) {
|
var allOk = global.unfilledMark(["#password", "#password2"], function(el) {
|
||||||
el.css("border-bottom", "1px solid red");
|
el.css("border-bottom", "1px solid red");
|
||||||
});
|
});
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
// Signs up the user and redirects to either the login page or the email
|
// 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
|
// confirmation, depending on whether or not SMTP is configured in the
|
||||||
// backend.
|
// backend.
|
||||||
global.signup = function() {
|
global.signup = function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
if ($("#password").val() !== $("#password2").val()) {
|
if ($("#password").val() !== $("#password2").val()) {
|
||||||
global.textSet("#err", "The two passwords don't match");
|
global.textSet("#err", "The two passwords don't match");
|
||||||
return;
|
return;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
<div class="auth-form-container">
|
<div class="auth-form-container">
|
||||||
<div class="auth-form">
|
<div class="auth-form">
|
||||||
|
<form onsubmit="window.commento.login(event)">
|
||||||
<div class="form-title">
|
<div class="form-title">
|
||||||
Login to continue
|
Login to continue
|
||||||
</div>
|
</div>
|
||||||
@ -42,7 +43,8 @@
|
|||||||
<div class="err" id="err"></div>
|
<div class="err" id="err"></div>
|
||||||
<div class="msg" id="msg"></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]]]/forgot">Trouble logging in? Reset your password.</a>
|
||||||
<a class="link" href="[[[.Origin]]]/signup">Don't have an account yet? Sign up.</a>
|
<a class="link" href="[[[.Origin]]]/signup">Don't have an account yet? Sign up.</a>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
<div class="auth-form-container">
|
<div class="auth-form-container">
|
||||||
<div class="auth-form">
|
<div class="auth-form">
|
||||||
|
<form onsubmit="window.commento.resetPassword(event)">
|
||||||
<div class="form-title">
|
<div class="form-title">
|
||||||
Reset your Password
|
Reset your Password
|
||||||
</div>
|
</div>
|
||||||
@ -33,7 +34,8 @@
|
|||||||
|
|
||||||
<div class="err" id="err"></div>
|
<div class="err" id="err"></div>
|
||||||
<div class="msg" id="msg"></div>
|
<div class="msg" id="msg"></div>
|
||||||
<button id="reset-button" class="button" onclick="window.commento.resetPassword()">Reset Password</button>
|
<button id="reset-button" class="button" type="submit">Reset Password</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
<div class="auth-form-container">
|
<div class="auth-form-container">
|
||||||
<div class="auth-form">
|
<div class="auth-form">
|
||||||
|
<form onsubmit="window.commento.signup(event)">
|
||||||
<div class="form-title">
|
<div class="form-title">
|
||||||
Create an account
|
Create an account
|
||||||
</div>
|
</div>
|
||||||
@ -55,7 +56,8 @@
|
|||||||
<p class="cent">
|
<p class="cent">
|
||||||
</p>
|
</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>
|
<a class="link" href="[[[.Origin]]]/login">Already have an account? Login instead.</a>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user