diff options
author | Hilmar R <u02@u29lx193> | 2021-01-28 22:08:38 +0100 |
---|---|---|
committer | Hilmar R <u02@u29lx193> | 2021-01-28 22:08:38 +0100 |
commit | 4ecb4189b8787d57c601ebf467ecd94fa706d1ca (patch) | |
tree | 7e557b35df239b135dc8e811ad424b5f913e9f25 | |
parent | d0d6170a71a1acd73995450e16586a7b69abb3e1 (diff) | |
download | volse-hubzilla-4ecb4189b8787d57c601ebf467ecd94fa706d1ca.tar.gz volse-hubzilla-4ecb4189b8787d57c601ebf467ecd94fa706d1ca.tar.bz2 volse-hubzilla-4ecb4189b8787d57c601ebf467ecd94fa706d1ca.zip |
Register panel interaction consistence usage
-rw-r--r-- | Zotlabs/Module/Regate.php | 2 | ||||
-rw-r--r-- | Zotlabs/Module/Register.php | 25 | ||||
-rw-r--r-- | view/js/mod_register.js | 102 | ||||
-rwxr-xr-x | view/tpl/register.tpl | 9 |
4 files changed, 84 insertions, 54 deletions
diff --git a/Zotlabs/Module/Regate.php b/Zotlabs/Module/Regate.php index f96796e8a..cf6b76bfa 100644 --- a/Zotlabs/Module/Regate.php +++ b/Zotlabs/Module/Regate.php @@ -162,7 +162,7 @@ class Regate extends \Zotlabs\Web\Controller { $msg = 'ZAR1239I ' . t('Channel successfull created') . ' ' . $did2; } else { - $msg = 'ZAR1239E ' . $new_channel['message'] . ' ' . $did2; + $msg = 'ZAR1239E ' . t('Channel still not created') . ' ' . $did2; } zar_log($msg . ' ' . $reonar['chan.did1'] . ' (' . $reonar['chan.name'] . ')'); } diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 64db7a253..1cf5af5b3 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -14,7 +14,7 @@ class Register extends Controller { function init() { // ZAR0 - + $result = null; $cmd = ((argc() > 1) ? argv(1) : ''); @@ -53,9 +53,10 @@ class Register extends Controller { * [hilmar:] * It may happen, the posted form arrives in a strange fashion. With the control of the duty hours * for registration, the input form was disabled at html. While receiving posted data, checks are - * required if all is on the right road (no posts accepted during off duty). + * required if all is on the right road (most posts are not accepted during off duty). * */ + $act = q("SELECT COUNT(*) AS act FROM account")[0]['act']; $duty = zar_register_dutystate(); @@ -82,7 +83,7 @@ class Register extends Controller { goaway(z_root() . '/regate/' . bin2hex($email) . 'e' ); } - if ( preg_match('/^d{1,1}[0-9]{1,10}$/', $email ) ) { + if ( preg_match('/^d{1,1}[0-9]{6,10}$/', $email ) ) { // dId2 A artifical & anonymous goaway(z_root() . '/regate/' . bin2hex($email) . 'a' ); } @@ -109,7 +110,7 @@ class Register extends Controller { } // s2 max daily - if ( self::check_reg_limits() ) return; + if ( self::check_reg_limits()['is'] ) return; // accept tos if(! x($_POST,'tos')) { @@ -209,7 +210,7 @@ class Register extends Controller { } else { notice('ZAR0236E ' . t('Invitation not in time or too late') . EOL); - goaway(z_root()); + goaway(z_root() . '/~'); } } else { @@ -217,7 +218,7 @@ class Register extends Controller { $msg = 'ZAR0235S ' . t('Invitation email failed'); zar_log($msg); notice($msg . EOL); - goaway(z_root()); + goaway(z_root() . '/~'); } } else { @@ -225,12 +226,12 @@ class Register extends Controller { $msg = 'ZAR0234S ' . t('Invitation code failed') ; zar_log($msg); notice( $msg . EOL); - goaway(z_root()); + goaway(z_root() . '/~'); } } else { notice('ZAR0232E ' . t('Invitations are not available') . EOL); - goaway(z_root()); + goaway(z_root() . '/~'); } @@ -388,7 +389,7 @@ class Register extends Controller { function get() { - + $registration_is = ''; $other_sites = ''; @@ -492,6 +493,12 @@ class Register extends Controller { $o = replace_macros(get_markup_template('register.tpl'), array( + '$tao' => "typeof(window.tao) == 'undefined' ? window.tao = {} : '';\n" + . "tao.zar = { vsn: '2.0.0', form: {}, msg: {} };\n" + . "tao.zar.patano = /^d[0-9]{6}$/;\n" + . "tao.zar.patema = /^[a-z0-9.-]{2,64}@[a-z0-9.-]{4,32}\.[a-z]{2,12}$/;\n" + . "tao.zar.msg.ZAR0239E = '" . t('email mistake') . "';\n", + '$form_security_token' => get_form_security_token("register"), '$title' => t('Registration'), '$reg_is' => $registration_is, diff --git a/view/js/mod_register.js b/view/js/mod_register.js index ba3c4cab3..16f9b6da1 100644 --- a/view/js/mod_register.js +++ b/view/js/mod_register.js @@ -1,59 +1,87 @@ $(document).ready(function() { - typeof(window.tao) == 'undefined' ? window.tao = {} : ''; - tao.zar = { vsn: '2.0.0' }; - $("#id_emailNOP").blur(function() { - var zreg_email = $("#id_email").val(); - $.get("register/email_check.json?f=&email=" + encodeURIComponent(zreg_email), function(data) { - $("#help_email").html(data.message); - zFormError("#help_email",data.error); - }); + // 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}$/; + + $('#zar014').click( function () { $('#zar015').toggle(); }); + + $('#id_email').change(function() { + tao.zar.form.email = $('#id_email').val(); + if (tao.zar.patano.test(tao.zar.form.email) == true ) { + //ano + } else { + if (tao.zar.patema.test(tao.zar.form.email) == false ) { + $('#help_email').removeClass('text-muted').addClass('zuirise').html(tao.zar.msg.ZAR0239E); + zFormError('#help_email',true); + } else { + $.get('register/email_check.json?f=&email=' + encodeURIComponent(tao.zar.form.email), function(data) { + $('#help_email').removeClass('text-muted').addClass('zuirise').html(data.message); + zFormError('#help_email',data.error); + }); + } + } + if ($('#id_email').val().length > 0) { + $('#newchannel-submit-button').removeAttr('disabled'); + } }); - $("#id_password").blur(function() { - if(($("#id_password").val()).length < 6 ) { - $("#help_password").html(aStr.pwshort); - zFormError("#help_password", true); + + $('#id_password').change(function() { + if(($('#id_password').val()).length < 6 ) { + $('#help_password').removeClass('text-muted').addClass('zuirise').html(aStr.pwshort); + zFormError('#help_password', true); } else { - $("#help_password").html(""); - zFormError("#help_password", false); + $('#help_password').html(''); + zFormError('#help_password', false); + $('#id_password2').focus(); + $('#id_password2').val().length > 0 ? $('#id_password2').trigger('change') : ''; } }); - $("#id_password2").blur(function() { - if($("#id_password").val() != $("#id_password2").val()) { - $("#help_password2").html(aStr.pwnomatch); - zFormError("#help_password2", true); + $('#id_password2').change(function() { + if($('#id_password').val() != $('#id_password2').val()) { + $('#help_password2').removeClass('text-muted').addClass('zuirise').html(aStr.pwnomatch); + zFormError('#help_password2', true); + $('#id_password').focus(); } else { - $("#help_password2").html(""); - zFormError("#help_password2", false); + $('#help_password2').html(''); + zFormError('#help_password2', false); } }); - $("#id_name").blur(function() { - $("#name-spinner").show(); - var zreg_name = $("#id_name").val(); - $.get("new_channel/autofill.json?f=&name=" + encodeURIComponent(zreg_name),function(data) { - $("#id_nickname").val(data); + $('#id_name').blur(function() { + $('#name-spinner').show(); + var zreg_name = $('#id_name').val(); + $.get('new_channel/autofill.json?f=&name=' + encodeURIComponent(zreg_name),function(data) { + $('#id_nickname').val(data); if(data.error) { - $("#help_name").html(""); - zFormError("#help_name",data.error); + $('#help_name').html(''); + zFormError('#help_name',data.error); } - $("#name-spinner").hide(); + $('#name-spinner').hide(); }); }); - - $("#id_nickname").blur(function() { - $("#nick-spinner").show(); - var zreg_nick = $("#id_nickname").val(); - $.get("new_channel/checkaddr.json?f=&nick=" + encodeURIComponent(zreg_nick),function(data) { - $("#id_nickname").val(data); + $('#id_nickname').blur(function() { + $('#nick-spinner').show(); + var zreg_nick = $('#id_nickname').val(); + $.get('new_channel/checkaddr.json?f=&nick=' + encodeURIComponent(zreg_nick),function(data) { + $('#id_nickname').val(data); if(data.error) { - $("#help_nickname").html(""); - zFormError("#help_nickname",data.error); + $('#help_nickname').html(''); + zFormError('#help_nickname',data.error); } - $("#nick-spinner").hide(); + $('#nick-spinner').hide(); }); }); + //$("buttom[name='submit']").submit((function() { + $('#register-form').submit(function(e) { + if ( $('.zform-error').length > 0 ) { + e.preventDefault(); + return false; + } + }); }); diff --git a/view/tpl/register.tpl b/view/tpl/register.tpl index dd6e2e937..9a81198c7 100755 --- a/view/tpl/register.tpl +++ b/view/tpl/register.tpl @@ -72,12 +72,7 @@ $('head').append( '<style> '+ ' .zuiqmid { font-weight: normal; font-family: monospace; }'+ + ' .zuirise { font-weight: bold; font-size: 100%; color: red; }'+ '</style>'); - // does not work $('#id_email').off('blur'); - $('#id_email').change( function() { - if ($('#id_email').val().length > 0) { - $('#newchannel-submit-button').removeAttr('disabled'); - } - }); - $('#zar014').click( function () { $('#zar015').toggle(); }); + {{$tao}} </script> |