Fixed several URLs
This commit is contained in:
parent
b70494f1ab
commit
4f4138e073
|
@ -258,14 +258,14 @@
|
||||||
<option>Zambia</option>
|
<option>Zambia</option>
|
||||||
<option>Zimbabwe</option>
|
<option>Zimbabwe</option>
|
||||||
</select>
|
</select>
|
||||||
<img id="flagimg" src="/img/flags/flags_medium/Afghanistan.png" />
|
<img id="flagimg" src="<?= base_url() ?>/img/flags/flags_medium/Afghanistan.png" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="register-right">
|
<div class="register-right">
|
||||||
<label>Profile image</label>
|
<label>Profile image</label>
|
||||||
<input type="file" name="imginput" id="imginput" required />
|
<input type="file" name="imginput" id="imginput" required />
|
||||||
<img src="/img/user.svg" id="profile-img">
|
<img src="<?= base_url() ?>/img/user.svg" id="profile-img">
|
||||||
|
|
||||||
<label>Resolve the captcha</label>
|
<label>Resolve the captcha</label>
|
||||||
<div id="captcha-box">
|
<div id="captcha-box">
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
</div><!-- #main -->
|
</div><!-- #main -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
const base_url = '<?= base_url() ?>';
|
||||||
|
</script>
|
||||||
<script type="text/javascript" src="<?=base_url()?>/js/pequejs.js"></script>
|
<script type="text/javascript" src="<?=base_url()?>/js/pequejs.js"></script>
|
||||||
<script type="text/javascript" src="<?=base_url()?>/js/app.js"></script>
|
<script type="text/javascript" src="<?=base_url()?>/js/app.js"></script>
|
||||||
<?php if(!empty($custom_js)): ?>
|
<?php if(!empty($custom_js)): ?>
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
//repeat password check
|
|
||||||
//update passwordcheck validation pattern to match password value when this change
|
|
||||||
$("#password").on('change', function() {
|
|
||||||
$("#passwordcheck").pattern = this.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
//profile image preview
|
//profile image preview
|
||||||
function readURL(input) {
|
function readURL(input) {
|
||||||
|
|
||||||
|
@ -24,13 +18,13 @@ $("#imginput").on('change', function() {
|
||||||
|
|
||||||
//flag image preview
|
//flag image preview
|
||||||
$("#flaginput").on('change', function() {
|
$("#flaginput").on('change', function() {
|
||||||
var newsrc='./img/flags/flags_medium/'+this.value.replace(' ','_')+'.png';
|
var newsrc = `${base_url}/img/flags/flags_medium/`+this.value.replace(' ','_')+'.png';
|
||||||
$("#flagimg").attr('src', newsrc);
|
$("#flagimg").attr('src', newsrc);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#refresh-captcha').on('click', function() {
|
$('#refresh-captcha').on('click', function() {
|
||||||
$().ajax(
|
$().ajax(
|
||||||
'/register/new_captcha',
|
`${base_url}/register/new_captcha`,
|
||||||
{
|
{
|
||||||
'dataType': 'text',
|
'dataType': 'text',
|
||||||
'success': function(res) {
|
'success': function(res) {
|
||||||
|
@ -43,21 +37,22 @@ $('#refresh-captcha').on('click', function() {
|
||||||
$('#reg-form > form').on('submit', function(e) {
|
$('#reg-form > form').on('submit', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Check if the password math
|
// Check if the password math
|
||||||
let passwd = $('#password').val();
|
const passwd = $('#password').val();
|
||||||
let passwdcheck = $('#passwordcheck').val();
|
const passwdcheck = $('#passwordcheck').val();
|
||||||
$('#register-error').hide();
|
$('#register-error').hide();
|
||||||
$('#passwd-error').hide();
|
$('#passwd-error').hide();
|
||||||
if (passwd != passwdcheck) {
|
|
||||||
|
if (passwd.normalize() != passwdcheck.normalize()) {
|
||||||
$('#passwd-error').show();
|
$('#passwd-error').show();
|
||||||
} else {
|
} else {
|
||||||
form_data = new FormData(this);
|
const form_data = new FormData(this);
|
||||||
|
|
||||||
$().ajax('/register/newuser', {
|
$().ajax(`${base_url}/register/newuser`, {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: form_data,
|
data: form_data,
|
||||||
success: (resp) => {
|
success: (resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
location.href = '/register/ok';
|
location.href = `${base_url}/register/ok`;
|
||||||
} else {
|
} else {
|
||||||
$('#register-error').text(resp.msg);
|
$('#register-error').text(resp.msg);
|
||||||
$('#register-error').show();
|
$('#register-error').show();
|
||||||
|
@ -68,11 +63,17 @@ $('#reg-form > form').on('submit', function(e) {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input').on('keyup', function() {
|
$('input').on('keyup', function() {
|
||||||
input = $(this);
|
const input = $(this);
|
||||||
inputID = '#' + input.attr('id');
|
const inputID = '#' + input.attr('id');
|
||||||
$(inputID + ' + .input-error').hide();
|
$(inputID + ' + .input-error').hide();
|
||||||
|
|
||||||
if (input.val() && input.is(':invalid')) $(inputID + ' + .input-error').show();
|
if (input.val() && input.is(':invalid')) $(inputID + ' + .input-error').show();
|
||||||
if (input.val() && inputID == '#password') $('#passwordcheck').attr('pattern', input.val())
|
if (input.val() && (inputID == '#password' || inputID == '#passwordcheck')) {
|
||||||
|
const passwd = $('#password').val();
|
||||||
|
const passwdcheck = $('#passwordcheck').val();
|
||||||
|
if (passwd.normalize() != passwdcheck.normalize()) $('#passwd-error').show();
|
||||||
|
else $('#passwd-error').hide();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#flaginput").trigger('change');
|
$("#flaginput").trigger('change');
|
||||||
|
|
Loading…
Reference in New Issue