creation envoie email passw
This commit is contained in:
parent
09f2d9cf37
commit
a3d2885c96
3 changed files with 22 additions and 2 deletions
18
public/javascripts/login.js
Normal file
18
public/javascripts/login.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
let socket = io.connect();
|
||||||
|
|
||||||
|
document.getElementById("login").addEventListener("submit", e=>{
|
||||||
|
e.preventDefault();
|
||||||
|
let expressionReguliere = /^(([^<>()[]\.,;:s@]+(.[^<>()[]\.,;:s@]+)*)|(.+))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
|
||||||
|
if(expressionReguliere.test(document.getElementById("mail-input").value)){
|
||||||
|
let email = document.getElementById("mail-input").value;
|
||||||
|
let passw = document.getElementById("password-input").value;
|
||||||
|
socket.emit("login", {"email":email,"password":passw});
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
socket.on("login", data=>{
|
||||||
|
if(data){
|
||||||
|
window.location.href = "/";
|
||||||
|
}
|
||||||
|
})
|
|
@ -5,7 +5,7 @@ html
|
||||||
link(href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet")
|
link(href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet")
|
||||||
link(rel="stylesheet", href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css")
|
link(rel="stylesheet", href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css")
|
||||||
link(rel="stylesheet", href="/stylesheets/style.css")
|
link(rel="stylesheet", href="/stylesheets/style.css")
|
||||||
|
script(src="/socket.io/socket.io.js")
|
||||||
body
|
body
|
||||||
block content
|
block content
|
||||||
script(src="/socket.io/socket.io.js")
|
|
||||||
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")
|
script(src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js")
|
||||||
|
|
|
@ -4,7 +4,7 @@ block content
|
||||||
div(class='row main-form')
|
div(class='row main-form')
|
||||||
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signin")
|
div(class='col s12 m8 offset-m2 signinup z-depth-5' id="signin")
|
||||||
h2 Welcome back
|
h2 Welcome back
|
||||||
form
|
form#login
|
||||||
div(class="input-field col s12")
|
div(class="input-field col s12")
|
||||||
i(class="material-icons prefix") mail
|
i(class="material-icons prefix") mail
|
||||||
input(type="text" id="mail-input" class="autocomplete")
|
input(type="text" id="mail-input" class="autocomplete")
|
||||||
|
@ -50,3 +50,5 @@ block content
|
||||||
label(for="mailforgot-input") Email
|
label(for="mailforgot-input") Email
|
||||||
|
|
||||||
input(type='submit' value='Send email')
|
input(type='submit' value='Send email')
|
||||||
|
|
||||||
|
script(src="/javascripts/login.js")
|
||||||
|
|
Reference in a new issue