From a9da370c0bf5777a0345744667240ef0c615dcaa Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Apr 2021 14:57:16 +0000 Subject: register: cleanup template --- view/js/mod_register.js | 22 +++++++++++++++------- view/tpl/js_strings.tpl | 4 +++- view/tpl/register.tpl | 12 ------------ 3 files changed, 18 insertions(+), 20 deletions(-) (limited to 'view') diff --git a/view/js/mod_register.js b/view/js/mod_register.js index 1b61e2b3d..3f8f50898 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -1,10 +1,14 @@ $(document).ready(function() { - // set in Module - //typeof(window.tao) == 'undefined' ? window.tao = {} : ''; - //tao.zar = { vsn: '2.0.0', form: {}, msg: {} }; - //tao.zar.patano = /^d[0-9]{6}$/; - //tao.zar.patema = /^[a-z0-9.-]{2,64}@[a-z0-9.-]{4,32}\.[a-z]{2,12}$/; + typeof(window.tao) == 'undefined' ? window.tao = {} : ''; + tao.zar = { vsn: '2.0.0', form: {}, msg: {} }; + tao.zar.patano = /^d[0-9]{5,10}$/; + tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/; + + $('.register_date').each( function () { + var date = new Date($(this).data('utc')); + $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'})); + }); $('#zar014').click( function () { $('#zar015').toggle(); }); @@ -14,7 +18,7 @@ $(document).ready(function() { //ano } else { if (tao.zar.patema.test(tao.zar.form.email) == false ) { - $('#help_email').removeClass('text-muted').addClass('text-danger').html(tao.zar.msg.ZAR0239E); + $('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_not_valid']); zFormError('#help_email',true); } else { $.get('register/email_check.json?f=&email=' + encodeURIComponent(tao.zar.form.email), function(data) { @@ -40,6 +44,7 @@ $(document).ready(function() { $('#id_password2').val().length > 0 ? $('#id_password2').trigger('change') : ''; } }); + $('#id_password2').change(function() { if($('#id_password').val() != $('#id_password2').val()) { $('#help_password2').removeClass('text-muted').addClass('text-danger').html(aStr.pwnomatch); @@ -64,7 +69,11 @@ $(document).ready(function() { $('#name-spinner').hide(); }); }); + $('#id_nickname').blur(function() { + if($('#id_name').val() === '') + return; + $('#nick-spinner').show(); var zreg_nick = $('#id_nickname').val(); $.get('new_channel/checkaddr.json?f=&nick=' + encodeURIComponent(zreg_nick),function(data) { @@ -77,7 +86,6 @@ $(document).ready(function() { }); }); - //$("buttom[name='submit']").submit((function() { $('#register-form').submit(function(e) { if ( $('.zform-error').length > 0 ) { e.preventDefault(); diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl index 291d78fb2..c0d8d104e 100644 --- a/view/tpl/js_strings.tpl +++ b/view/tpl/js_strings.tpl @@ -69,8 +69,10 @@ 'allday' : "{{$allday}}", // mod cloud + 'download_info' : "{{$download_info}}", - 'download_info' : "{{$download_info}}" + // mod register + 'email_not_valid' : "{{$email_not_valid}}" }; diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index d6f70d118..06e58721a 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -71,17 +71,5 @@ hilmar, 2020.02 *}} -- cgit v1.2.3 From cb2d8b4ba62f2510a1305bbe95452f4de008286a Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Apr 2021 15:03:05 +0000 Subject: register: minor js cleanup --- view/js/mod_register.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'view') diff --git a/view/js/mod_register.js b/view/js/mod_register.js index 3f8f50898..19be1576f 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -14,19 +14,17 @@ $(document).ready(function() { $('#id_email').change(function() { tao.zar.form.email = $('#id_email').val(); - if (tao.zar.patano.test(tao.zar.form.email) == true ) { - //ano + + if (tao.zar.patema.test(tao.zar.form.email) == false ) { + $('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_not_valid']); + zFormError('#help_email',true); } else { - if (tao.zar.patema.test(tao.zar.form.email) == false ) { - $('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_not_valid']); - zFormError('#help_email',true); - } else { - $.get('register/email_check.json?f=&email=' + encodeURIComponent(tao.zar.form.email), function(data) { + $.get('register/email_check.json?f=&email=' + encodeURIComponent(tao.zar.form.email), function(data) { $('#help_email').removeClass('text-muted').addClass('text-danger').html(data.message); zFormError('#help_email',data.error); - }); - } + }); } + if ($('#id_email').val().length > 0) { $('#newchannel-submit-button').removeAttr('disabled'); } -- cgit v1.2.3 From f3fa09fc91fe4ca2a44ee4f60d11c5ee70fcefad Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Apr 2021 16:06:43 +0000 Subject: register: more ui/ux --- view/en/register_verify_member.tpl | 11 +++++------ view/tpl/admin_site.tpl | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'view') diff --git a/view/en/register_verify_member.tpl b/view/en/register_verify_member.tpl index 5db51a2e2..926efbd11 100644 --- a/view/en/register_verify_member.tpl +++ b/view/en/register_verify_member.tpl @@ -10,15 +10,15 @@ Login with the password you chose at registration. We need to verify your email address in order to give you full access. -Your validation code is +Your validation token is {{$hash}} - -{{if $due}}{{$due}}{{/if}} - +{{if $timeframe}} +This token is valid from {{$timeframe.0}} UTC until {{$timeframe.1}} UTC +{{/if}} If you registered this account, please enter the validation code when requested or visit the following link: {{$siteurl}}/regate/{{$mail}} @@ -26,11 +26,10 @@ If you registered this account, please enter the validation code when requested To deny the request and remove the account, please visit: - {{$siteurl}}/regate/{{$mail}}{{if $ko}}/{{$ko}}{{/if}} -Thank you. +Thank you! -- diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index b6fd2348d..5d51932eb 100644 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -36,7 +36,7 @@ {{** include file="field_checkbox.tpl" field=$register_wo_email **}} {{include file="register_duty.tpl" field=$register_duty}} {{include file="field_input.tpl" field=$register_perday}} - {{** include file="field_input.tpl" field=$register_sameip **}} + {{include file="field_input.tpl" field=$register_sameip}} {{$reg_delay}} {{$reg_expire}} {{include file="field_checkbox.tpl" field=$reg_autochannel}} -- cgit v1.2.3 From 18b6d48944be414acc179fb82f458f996810e5a3 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Apr 2021 19:55:53 +0000 Subject: rgister: fixes for registering with invitecode outside of open hours --- view/js/mod_register.js | 15 +++++++++++++++ view/tpl/register.tpl | 17 +++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'view') diff --git a/view/js/mod_register.js b/view/js/mod_register.js index 19be1576f..7ad972c79 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -12,6 +12,21 @@ $(document).ready(function() { $('#zar014').click( function () { $('#zar015').toggle(); }); + $('#id_invite_code').blur(function() { + if($('#id_invite_code').val() === '') + return; + + $('#invite-spinner').show(); + var zreg_invite = $('#id_invite_code').val(); + $.get('register/invite_check.json?f=&invite_code=' + encodeURIComponent(zreg_invite),function(data) { + if(!data.error) { + // FIXME: set email field to required -> $('#help_email') + $('#register-form input, #register-form button').removeAttr('disabled'); + } + $('#invite-spinner').hide(); + }); + }); + $('#id_email').change(function() { tao.zar.form.email = $('#id_email').val(); diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index 06e58721a..7940b8945 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -29,6 +29,17 @@ {{include file="field_select_grouped.tpl" field=$role}} {{/if}} + {{if $invitations}} + {{$haveivc}} + + {{/if}} + +
{{include file="field_input.tpl" field=[$name.0,$name.1,"","","",$atform]}} @@ -40,12 +51,6 @@ {{/if}}
- {{if $invitations}} - {{$haveivc}} - - {{/if}} {{include file="field_input.tpl" field=$email}}
-- cgit v1.2.3 From 01b081d809d128e0922fb404921f452c51c2ddb2 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 9 Apr 2021 09:49:36 +0000 Subject: register: only return verified registrations in get_pending_accounts(), more invite handling fixes --- view/js/mod_register.js | 7 +++++-- view/tpl/js_strings.tpl | 3 ++- view/tpl/register.tpl | 19 +++++++++---------- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'view') diff --git a/view/js/mod_register.js b/view/js/mod_register.js index 7ad972c79..948ba756b 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -10,7 +10,9 @@ $(document).ready(function() { $(this).html(date.toLocaleString(undefined, {weekday: 'short', hour: 'numeric', minute: 'numeric'})); }); - $('#zar014').click( function () { $('#zar015').toggle(); }); + $('#zar014').click( function () { + $('#zar015').toggle(); + }); $('#id_invite_code').blur(function() { if($('#id_invite_code').val() === '') @@ -20,8 +22,9 @@ $(document).ready(function() { var zreg_invite = $('#id_invite_code').val(); $.get('register/invite_check.json?f=&invite_code=' + encodeURIComponent(zreg_invite),function(data) { if(!data.error) { - // FIXME: set email field to required -> $('#help_email') $('#register-form input, #register-form button').removeAttr('disabled'); + // email is always mandatory if using invite code + $('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_required']); } $('#invite-spinner').hide(); }); diff --git a/view/tpl/js_strings.tpl b/view/tpl/js_strings.tpl index c0d8d104e..8f05165f1 100644 --- a/view/tpl/js_strings.tpl +++ b/view/tpl/js_strings.tpl @@ -72,7 +72,8 @@ 'download_info' : "{{$download_info}}", // mod register - 'email_not_valid' : "{{$email_not_valid}}" + 'email_not_valid' : "{{$email_not_valid}}", + 'email_required' : "{{$email_required}}" }; diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index 7940b8945..fe67abe89 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -19,16 +19,6 @@
{{/if}} - {{if $auto_create}} - {{if $default_role}} - - {{else}} - - {{include file="field_select_grouped.tpl" field=$role}} - {{/if}} - {{if $invitations}} {{$haveivc}} {{/if}} + {{if $auto_create}} + {{if $default_role}} + + {{else}} + + {{include file="field_select_grouped.tpl" field=$role}} + {{/if}}
-- cgit v1.2.3 From 766fc92a3b9af06ebeda2f017e0f9fbe31eb3179 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 9 Apr 2021 19:25:31 +0000 Subject: register: we use default role if auto create is configured --- view/tpl/register.tpl | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'view') diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index fe67abe89..761e48773 100644 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -20,25 +20,16 @@ {{/if}} {{if $invitations}} - {{$haveivc}} -