diff --git a/public/assets/js/site.js b/public/assets/js/site.js index b82f2e1..56e144d 100644 --- a/public/assets/js/site.js +++ b/public/assets/js/site.js @@ -271,17 +271,35 @@ jQuery(function($) { let reg_pass = document.getElementById("reg_pass"); let conf_pass = document.getElementById("conf_pass"); let reg_email = document.getElementById("reg_email"); + let checkpass = checkPass(reg_pass,conf_pass); + body ='{"username": "'+ user +'","password": "'+ pass +'","email": "'+ email +'"}'; - reg_body ='{"username": "'+ user +'","password": "'+ pass +'","email": "'+ email +'"}'; + reg_body ='{"username": "'+ reg_user +'","password": "'+ checkpass +'","email": "'+ reg_email +'"}'; + + function checkPass(s1,s2){ + if (s1==s2){ + return s1 + } + else { + return "error: pass don't match" + } + } if (value) { let req = require('request'); - req.post({ headers: {'content-type' : 'application/json'}, url: "", body: body }, function(error, response, body){console.log(body); }); + req.post({ headers: {'content-type' : 'application/json'}, url: "", body: body }, function(error, response, body){console.log(body);console.log(response);console.log(error); }); } + else { - let req = require('request'); - req.post({ headers: {'content-type' : 'application/json'}, url: "", body: reg_body }, function(error, response, body){console.log(body); }); - } + + var url = "/api/auth/signup"; + var params = reg_body; + var xhr = new XMLHttpRequest(); + xhr.open("POST", url, true); + xhr.setRequestHeader("Content-type", "application/json"); + xhr.send(params); + console.log(xhr.responseText) + } } // player things @@ -345,7 +363,7 @@ jQuery(function($) { console.log("registerTab"); tab1bj.setAttribute("aria-selected", "false"); tab2bj.setAttribute("aria-selected", "true"); - mainbj.innerHTML = "
" + mainbj.innerHTML = "
" } // other scripts diff --git a/public/index.html b/public/index.html index 8ce9dc3..2ab52d5 100644 --- a/public/index.html +++ b/public/index.html @@ -112,7 +112,7 @@
Microsoft❮R❯ Windows DOS 
 ❮C❯ Copyright Microsoft Corp 1990-2001.
                                   
C:\WINDOWS\RIPBOZO> type oof.txt -T'ES PAS CONNECTÉ :*( +
T'ES PAS CONNECTÉ :*(