register: more ui/ux work

This commit is contained in:
Mario
2021-04-07 20:50:34 +02:00
parent 6956eadaad
commit 806f50eee3
5 changed files with 67 additions and 56 deletions

View File

@@ -244,8 +244,8 @@ class Register extends Controller {
intval($reg['reg_id'])
);
$msg = 'ZAR0237I ' . t('Invitation code succesfully applied');
zar_log($msg) . ', ' . $email;
$msg = t('Invitation code succesfully applied');
zar_log('ZAR0237I ' . $msg) . ', ' . $email;
// msg!
info($msg . EOL);
@@ -261,29 +261,29 @@ class Register extends Controller {
} else {
// msg!
notice('ZAR0236E ' . t('Invitation not in time or too late') . EOL);
goaway(z_root() . '/~');
notice(t('Invitation not in time or too late') . EOL);
return;
}
} else {
// no match email adr
$msg = 'ZAR0235S ' . t('Invitation email failed');
zar_log($msg);
$msg = t('Invitation email failed');
zar_log('ZAR0235S ' . $msg);
notice($msg . EOL);
goaway(z_root() . '/~');
return;
}
} else {
// no match invitecode
$msg = 'ZAR0234S ' . t('Invitation code failed') ;
zar_log($msg);
$msg = t('Invitation code failed') ;
zar_log('ZAR0234S ' . $msg);
notice( $msg . EOL);
goaway(z_root() . '/~');
return;
}
} else {
notice('ZAR0232E ' . t('Invitations are not available') . EOL);
goaway(z_root() . '/~');
notice(t('Invitations are not available') . EOL);
return;
}
@@ -309,20 +309,20 @@ class Register extends Controller {
} else {
$msg = 'ZAR0237E ' . t('Email address already in use') . EOL;
$msg = t('Email address already in use') . EOL;
notice($msg);
// problem, the msg tells to anonymous about existant email addrs
// use another msg instead ? TODO ?
// on the other hand can play the fail2ban game
zar_log($msg . ' (' . $email . ')');
goaway(z_root());
zar_log('ZAR0237E ' . $msg . ' (' . $email . ')');
return;
}
} else {
$msg = 'ZAR0233E ' . t('Registration on this hub is by invitation only') . EOL;
$msg = t('Registration on this hub is by invitation only') . EOL;
notice($msg);
zar_log($msg);
goaway(z_root());
zar_log('ZAR0233E ' . $msg);
return;
}
}
@@ -442,9 +442,9 @@ class Register extends Controller {
goaway(z_root() . '/regate/' . bin2hex('d' . $didnew) . 'a' );
}
else {
$msg = 'ZAR0239D,' . t('Error creating dId A');
$msg = t('Error creating dId A');
notice( $msg );
zar_log( $msg . ' ' . $did2);
zar_log( 'ZAR0239D,' . $msg . ' ' . $did2);
}
}
goaway(z_root() . '/regate/' . bin2hex($email) . $didx );
@@ -461,7 +461,7 @@ class Register extends Controller {
if(intval(get_config('system','register_policy')) === REGISTER_CLOSED) {
if(intval(get_config('system','directory_mode')) === DIRECTORY_MODE_STANDALONE) {
notice( 'ZAR0130E ' . t('Registration on this hub is disabled.') . EOL);
notice(t('Registration on this hub is disabled.') . EOL);
return;
}
@@ -540,7 +540,7 @@ class Register extends Controller {
$invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : ""));
//
$name = array('name', t('Your Name'),
$name = array('name', t('Your name'),
((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Real names are preferred.'));
$nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl'));
$nickname = array('nickname', t('Choose a short nickname'),
@@ -565,7 +565,7 @@ class Register extends Controller {
'$tao' => "typeof(window.tao) == 'undefined' ? window.tao = {} : '';\n"
. "tao.zar = { vsn: '2.0.0', form: {}, msg: {} };\n"
. "tao.zar.patano = /^d[0-9]{5,10}$/;\n"
. "tao.zar.patema = /^[a-z0-9.-]{2,64}@[a-z0-9.-]{4,32}\.[a-z]{2,12}$/;\n"
. "tao.zar.patema = /^[a-z0-9.-]{1,64}@[a-z0-9.-]{2,32}\.[a-z]{2,12}$/;\n"
. "tao.zar.msg.ZAR0239E = '" . t('Email address not valid') . "';\n",
'$form_security_token' => get_form_security_token("register"),
@@ -624,8 +624,8 @@ class Register extends Controller {
}
if ( $rear['is']) {
$rear['msg'] = 'ZAR0333W ' . t('This site has exceeded the number of allowed daily account registrations');
zar_log($msg);
$rear['msg'] = t('This site has exceeded the number of allowed daily account registrations.');
zar_log('ZAR0333W ' . $rear['msg']);
$rear['is'] = true;
}
}

View File

@@ -1,4 +1,4 @@
/**
* ADMIN
@@ -9,7 +9,7 @@
font-weight: bold;
background-color: #FF0000;
padding: 0em 0.3em;
}
#adminpage dl {
clear: left;
@@ -74,3 +74,18 @@
tr.zebra9 { background-color: #eafaf1; }
tr.zebra0 { background-color: #fbeee6; }
tr.zebra1 { background-color: #fef9e7; }
.zuiqmid {
font-weight: normal;
font-family: monospace;
}
.zui_n {
width: 5em;
text-align: center;
}
.zuia {
cursor: pointer;
font-weight: bold;
}

View File

@@ -14,11 +14,11 @@ $(document).ready(function() {
//ano
} else {
if (tao.zar.patema.test(tao.zar.form.email) == false ) {
$('#help_email').removeClass('text-muted').addClass('zuirise').html(tao.zar.msg.ZAR0239E);
$('#help_email').removeClass('text-muted').addClass('text-danger').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);
$('#help_email').removeClass('text-muted').addClass('text-danger').html(data.message);
zFormError('#help_email',data.error);
});
}
@@ -30,7 +30,7 @@ $(document).ready(function() {
$('#id_password').change(function() {
if(($('#id_password').val()).length < 6 ) {
$('#help_password').removeClass('text-muted').addClass('zuirise').html(aStr.pwshort);
$('#help_password').removeClass('text-muted').addClass('text-danger').html(aStr.pwshort);
zFormError('#help_password', true);
}
else {
@@ -42,7 +42,7 @@ $(document).ready(function() {
});
$('#id_password2').change(function() {
if($('#id_password').val() != $('#id_password2').val()) {
$('#help_password2').removeClass('text-muted').addClass('zuirise').html(aStr.pwnomatch);
$('#help_password2').removeClass('text-muted').addClass('text-danger').html(aStr.pwnomatch);
zFormError('#help_password2', true);
$('#id_password').focus();
}

View File

@@ -127,12 +127,4 @@
}
});
});
// [hilmar->
$('head').append(
'<style> '+
' .zuiqmid { font-weight: normal; font-family: monospace; }'+
' .zui_n { width: 5em; text-align: center; }'+
' .zuia { cursor: pointer; font-weight: bold; }'+
'</style>');
// <-hilmar]
</script>

View File

@@ -7,7 +7,7 @@
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
{{if $reg_is || $other_sites || $now || $msg}}
<div class="section-content-warning-wrapper">
<h3>{{$now}}</h3>
<div class="h3">{{$now}}</div>
<div id="register-desc" class="descriptive-paragraph">{{$msg}}</div>
<div id="register-desc" class="descriptive-paragraph">{{$reg_is}}</div>
<div id="register-sites" class="descriptive-paragraph">{{$other_sites}}</div>
@@ -19,6 +19,26 @@
</div>
{{/if}}
{{if $auto_create}}
{{if $default_role}}
<input type="hidden" name="permissions_role" value="{{$default_role}}" />
{{else}}
<div class="section-content-info-wrapper">
{{$help_role}}
</div>
{{include file="field_select_grouped.tpl" field=$role}}
{{/if}}
<div class="position-relative">
<div id="name-spinner" class="spinner-wrapper position-absolute" style="top: 2.5rem; right: 0.5rem;"><div class="spinner s"></div></div>
{{include file="field_input.tpl" field=[$name.0,$name.1,"","","",$atform]}}
</div>
<div class="position-relative">
<div id="nick-spinner" class="spinner-wrapper position-absolute" style="top: 2.5rem; right: 0.5rem;"><div class="spinner s"></div></div>
{{include file="field_input.tpl" field=[$nickname.0,$nickname.1,"","","",$atform]}}
</div>
{{/if}}
<div>
{{if $invitations}}
<a id="zar014" href="javascript:;" style="display: inline-block;">{{$haveivc}}</a>
@@ -34,22 +54,6 @@
{{include file="field_password.tpl" field=$pass2}}
{{if $auto_create}}
{{if $default_role}}
<input type="hidden" name="permissions_role" value="{{$default_role}}" />
{{else}}
<div class="section-content-info-wrapper">
{{$help_role}}
</div>
{{include file="field_select_grouped.tpl" field=$role}}
{{/if}}
{{include file="field_input.tpl" field=[$name.0,$name.1,"","","",$atform]}}
<div id="name-spinner" class="spinner-wrapper"><div class="spinner m"></div></div>
{{include file="field_input.tpl" field=[$nickname.0,$nickname.1,"","","",$atform]}}
<div id="nick-spinner" class="spinner-wrapper"><div class="spinner m"></div></div>
{{/if}}
{{if $enable_tos}}
{{include file="field_checkbox.tpl" field=[$tos.0,$tos.1,"","","",$atform]}}