Q: Restricting Channel Addresses/nicknames in Registration
I hoped I could get some help with adding a feature to the registration process, or finding the feature if it already exists somewhere...
Goal 1: restrict/require new channel addresses to be the same as the prefix/local-part of the account's email
Basically the the vast majority of users on my server will have the same email format:
firstname.lastname@...
For standardisation across the site it would be great if everyone's channel had this same format as their address/nickname.
Implementation: This could either be clear on the registration page, with the nickname immutably fixed to the prefix of the email given (with a notice to contact the admin if they want it changed otherwise), or simply remove the nickname input box and copy it across in the background.
Less-important Goal 2: auto-fill server-allowed email(s) during registration
As almost everyone will have the same email domain too, it would be good to have the option to have the domain already filled in (immutably). So you just fill in your email prefix, which will also serve as your channel address.
(I've already restricted registrations to this 1 allowed domain) If this would become a Hubzilla feature used by others, then if there are multiple allowed domains, then maybe some dropdown box for the possible options would be useful too, for making clear what domains are allowed/making registration quicker.
I'm happy editing the registration window already, but I don't have any clue how to handle the (although basic) js yet, so any help would be great! If this has already been implemented, then even better. Thanks in advance.
(I'm not an expert bc my server is a pretty experimental idea still, I'm not sure how well adopted it will be by the target audience)
This is the code in
public_html/view/js/mod_register.js
right now...
Click to open/close
$('#id_email').change(function() {
tao.zar.form.email = $('#id_email').val();
if (tao.zar.patema.test(tao.zar.form.email) == false ) {
$('#help_email').removeClass('text-muted').addClass('text-danger').html(aStr['email_not_valid']);
} else {
$.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);
});
}
});
$('#id_nickname').blur(function() {
if($('#id_name').val() == '')
return;
$('#nick-spinner').fadeIn();
$('#nick-hub').fadeOut();
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);
}
$('#nick-spinner').fadeOut();
$('#nick-hub').fadeIn();
});
});