(function() { $(\'#adminValidator\').wizard({ onInit: function() { $(\'#validation\').formValidation({ framework: \'bootstrap\', fields: { username: { validators: { notEmpty: { message: \'The username is required\' }, stringLength: { min: 3, max: 30, message: \'The username must be more than 2 and less than 30 characters long\' }, regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: \'The username can only consist of alphabetical, number, dot and underscore\' } } }, license: { validators: { regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: \'Please choose a license\' } } }, email: { validators: { notEmpty: { message: \'The email address is required\' }, emailAddress: { message: \'The input is not a valid email address\' } } }, hashKey: { validators: { notEmpty: { message: \'The hash key is required\' }, stringLength: { min: 3, max: 30, message: \'The hash key must be more than 2 and less than 30 characters long\' } } }, location: { validators: { notEmpty: { message: \'The database location is required\' } } }, dbName: { validators: { notEmpty: { message: \'The Database Name is required\' }, stringLength: { min: 2, max: 30, message: \'The Database Name must be more than 1 and less than 30 characters long\' }, regexp: { regexp: /^[a-zA-Z0-9_\.]+$/, message: \'The Database Name can only consist of alphabetical, number, dot and underscore\' } } }, api: { validators: { notEmpty: { message: \'The API Key is required\' }, stringLength: { min: 20, max: 20, message: \'The API Key must be 20 characters long\' } } }, registrationPassword: { validators: { notEmpty: { message: \'The registration password is required\' } } }, password: { validators: { notEmpty: { message: \'The password is required\' }, different: { field: \'username\', message: \'The password cannot be the same as username\' } } } } }); }, validator: function() { var fv = $(\'#validation\').data(\'formValidation\'); var $this = $(this); // Validate the container fv.validateContainer($this); var isValidStep = fv.isValidContainer($this); if (isValidStep === false || isValidStep === null) { return false; } return true; }, onFinish: function() { //$(\'#validation\').submit(); var post = $( \'#validation\' ).serializeArray(); console.log( post ); organizrAPI(\'POST\',\'api/?v1/wizard_config\',post).success(function(data) { var html = JSON.parse(data); if(html.data == true){ location.reload(); }else if(html.data == \'token\'){ message("",window.lang.translate(\'Could not create Token\'),activeInfo.settings.notifications.position,"#FFF","error","3500"); console.error(\'Organizr Function: Could not create Token\'); }else if(html.data == \'db\'){ message("",window.lang.translate(\'Could not create DB - check permissions\'),activeInfo.settings.notifications.position,"#FFF","error","3500"); console.error(\'Organizr Function: Could not create DB - check permissions\'); }else if(html.data == \'admin\'){ message("",window.lang.translate(\'Could not create admin acct\'),activeInfo.settings.notifications.position,"#FFF","error","3500"); console.error(\'Organizr Function: Could not create admin acct\'); }else if(html.data == \'config\'){ message("",window.lang.translate(\'Could not create config files - check permissions\'),activeInfo.settings.notifications.position,"#FFF","error","3500"); console.error(\'Organizr Function: Could not create config files - check permissions\'); }else{ message("",window.lang.translate(\'Sign-up Error Occurred\'),activeInfo.settings.notifications.position,"#FFF","error","3500"); console.error(\'Organizr Function: Sign-up Error Occurred\'); } }).fail(function(xhr) { console.error("Organizr Function: Connection Failed"); }); } }); generateAPI(); $( ".wizardInput" ).focusout(function() { var value = $(this).val(); var name = $(this).attr(\'name\'); if (typeof value !== \'undefined\' && typeof name !== \'undefined\') { $(\'#verify-\'+name).text(value); } }); })();