Commit debe2e30 authored by Romain Loth's avatar Romain Loth

fix registration form namespace issues that came up after js refactoring

parent dbb64780
......@@ -112,7 +112,7 @@ function testDoorsUserExists(emailValue) {
function registerDoorsAndSubmit(){
mainMessage.innerHTML = "Registering with ISCPIF Doors..."
cmxClt.uform.mainMessage.innerHTML = "Registering with ISCPIF Doors..."
// all values from the form have now been validated
var emailValue = cmxClt.uauth.email.value
......@@ -129,7 +129,7 @@ function registerDoorsAndSubmit(){
// REGISTERING ON THE DOORS -------------------------------------
// /!\ async
callDoors(
cmxClt.uauth.callDoors(
"register",
[emailValue, passValue, wholenameValue],
......@@ -152,8 +152,7 @@ function addUidThenSubmit(doorsResp) {
}
else {
// fill in the answer we got
// £TODO fix scope uauth and uform ?
uidInput.value = doorsUid
ccModule.uauth.uidInput.value = doorsUid
console.info("form was validated and registered@doors: submitting now")
......@@ -187,7 +186,7 @@ function validateAndMsg() {
if (jobDate.value.length) jobDate.value = (new Date(jobDate.value)).toISOString()
// objectify the form
cmxClt.uform.wholeFormData = new FormData(theForm);
cmxClt.uform.wholeFormData = new FormData(cmxClt.uform.theForm);
var missingFields = []
var toolongFields = []
......@@ -246,8 +245,8 @@ function validateAndMsg() {
// RESULTS
if (valid) {
// add the captchaCheck inside the form (TODO should be automatic via realperson or uauth submodules)
cmxClt.uauth.captchaCheck.value = $(captcha).realperson('getHash')
// adds the captchaCheck inside the form
ccModule.uauth.collectCaptcha()
cmxClt.uform.mainMessage.innerHTML = "Form is valid... Will register and submit..."
cmxClt.uform.mainMessage.style.display = 'block'
......
......@@ -17,6 +17,7 @@
// cmxClt module augmentation
// POSS remove ccModule.auth. namespace prefix from local scope vars
cmxClt = (function(ccModule) {
// common vars to authenticating/registering in user area
ccModule.uauth = {}
......@@ -30,18 +31,25 @@ cmxClt = (function(ccModule) {
// str of the form: doors_hostname:doors_port
ccModule.uauth.doorsConnectParam = document.getElementById('doors_connect').value
// captchaHash should be appended by itself if normal submit,
// but we may need to do it ourselves (TODO test)
// captcha
// -------
ccModule.uauth.captcha = document.getElementById('my-captcha')
ccModule.uauth.captchaCheck = document.getElementById('my-captchaHash')
// param for generation & validation
ccModule.uauth.realCaptchaLength = 5
// initialize pseudo captcha
$('#my-captcha').realperson({length: ccModule.uauth.realCaptchaLength});
// captcha init
$(cmxClt.uauth.captcha).realperson({length: ccModule.uauth.realCaptchaLength})
// captchaHash should be appended by itself if normal submit,
// but otherwise we need to do it ourselves with collectCaptcha()
ccModule.uauth.captchaCheck = document.getElementById('my-captchaHash')
ccModule.uauth.collectCaptcha = function() {
ccModule.uauth.captchaCheck.value = $(cmxClt.uauth.captcha).realperson('getHash')
}
// doors-related html elements
// ---------------------------
ccModule.uauth.doorsMessage = document.getElementById('doors_ret_message')
ccModule.uauth.doorsIconMessage = document.getElementById('doors_ret_icon_msg')
ccModule.uauth.doorsIcon = document.getElementById('doors_ret_icon')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment