Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkmp29 authored and mxkmp29 committed Aug 11, 2016
1 parent 8aae1a4 commit aa73579
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
12 changes: 12 additions & 0 deletions language/en-GB/en-GB.com_users.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
COM_USERS_ACTIVATION_TOKEN_NOT_FOUND="Verification code not found."
COM_USERS_CAPTCHA_LABEL="Captcha"
COM_USERS_CAPTCHA_DESC="Please complete the security check."
COM_USERS_CONFIG_FIELD_USERNAME_ALPHANUMERIC_REQUIRED="Only alphanumeric characters for username field are allowed."
COM_USERS_CONFIG_FIELD_USERNAME_CHARSET_REQUIRED="This characters in 'username' are not allowed: '%s'"
COM_USERS_CONFIG_FIELD_USERNAME_EMAIL_REQUIRED="The username field must be a valid email adress."
COM_USERS_CONFIG_FIELD_USERNAME_IDSTART_REQUIRED="First character in username must be a letter."
COM_USERS_CONFIG_FIELD_USERNAME_IDCONTINUE_REQUIRED="This characters don't fit the Unicode Default Identifier Syntax: %s"
COM_USERS_CONFIG_FIELD_USERNAME_IDPROFILE_REQUIRED="There are characters in username not allowed by Unicode Consortium for being part of an identifier. This characters are: %s"
COM_USERS_CONFIG_FIELD_USERNAME_LATIN_REQUIRED="Only latin characters are allowed in username field. This characters are not latin: %s"
COM_USERS_CONFIG_FIELD_USERNAME_M3AAWG_REQUIRED="Only this combinations are allowed for East Asian Languages in accordance with M3AAWG best practices for username field: [Latin + Han + Hiragana + Katakana] OR [Latin + Han + Bopomofo] OR [Latin + Han + Hangul]"
COM_USERS_CONFIG_FIELD_USERNAME_MAXNUMCHARS_REQUIRED="The username field should contain a maximum of %d characters, but you give %d."
COM_USERS_CONFIG_FIELD_USERNAME_MINNUMCHARS_REQUIRED="The username field should contain a minimum of %d characters. You only give %d."
COM_USERS_CONFIG_FIELD_USERNAME_NOOPTION="Option not allowed."
COM_USERS_CONFIG_FIELD_USERNAME_ONESCRIPT_REQUIRED="Only characters from one language are allowed for username."
COM_USERS_DATABASE_ERROR="Error getting the user from the database: %s"
COM_USERS_DESIRED_PASSWORD="Enter your desired password."
COM_USERS_DESIRED_USERNAME="Enter your desired username."
Expand Down
20 changes: 7 additions & 13 deletions libraries/joomla/form/rule/username.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,8 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry
$app = JFactory::getApplication();

// Load language files
if ($app->isSite())
{
JFactory::getLanguage()->load('com_users', JPATH_SITE, null, true);
}
elseif ($app->isAdmin())
{
JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR, null, true);
}
JFactory::getLanguage()->load('com_users');

// Get the database object and a new query object.
$db = JFactory::getDbo();
$query = $db->getQuery(true);
Expand Down Expand Up @@ -128,7 +122,7 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry
// Check if all the $uname chars are valid chars
if (!empty($invalid_chars))
{
$app->enqueueMessage(JText::sprintf('COM_USERS_CONFIG_FIELD_USERNAME_CHARSET_REQUIRED', implode(' ', $invalid_chars)), 'warning');
$app->enqueueMessage(JText::sprintf('COM_USERS_CONFIG_FIELD_USERNAME_CHARSET_REQUIRED', implode('', $invalid_chars)), 'warning');
$result = false;
}
break;
Expand All @@ -138,9 +132,9 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry
// All that match is rejected
$regExp = (string) $params->get('custom_chars_username');

if (preg_match_all($regExp, $value, $nonRegExpChars))
if (preg_match_all($regExp, $value, $regExpChars))
{
$nonRegExpString = implode(' ', array_unique($nonRegExpChars[0]));
$nonRegExpString = preg_replace($regExp, '', $value);

// Enqueue error message and return false
$app->enqueueMessage(JText::sprintf('COM_USERS_CONFIG_FIELD_USERNAME_CHARSET_REQUIRED', $nonRegExpString), 'warning');
Expand Down Expand Up @@ -305,15 +299,15 @@ public function test(SimpleXMLElement $element, $value, $group = null, Registry
if (!JMailHelper::isEmailAddress($value) )
{
// Enqueue error message and return false
$app->enqueueMessage(JText::sprintf('COM_USERS_CONFIG_FIELD_USERNAME_EMAIL_REQUIRED', implode(' ', $invalid_chars)), 'warning');
$app->enqueueMessage(JText::_('COM_USERS_CONFIG_FIELD_USERNAME_EMAIL_REQUIRED'), 'warning');

$result = false;
}
break;

default:
// NO OPTION
$app->enqueueMessage(JText::sprintf('COM_USERS_CONFIG_FIELD_USERNAME_NOOPTION'), 'warning');
$app->enqueueMessage(JText::_('COM_USERS_CONFIG_FIELD_USERNAME_NOOPTION'), 'warning');

return false;
}
Expand Down
8 changes: 4 additions & 4 deletions media/com_users/js/validate-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
console.log(data);
if(data.success){
var message = {
'error' : [data.message]
'warning' : [data.message]
};
Joomla.renderMessages(message);
}else if(!data.success && data.message){ //Invalid token
Expand All @@ -36,7 +36,7 @@
}).done(function (data) {
if (data.success) {
var message = {
'error': [data.message]
'warning': [data.message]
};
Joomla.renderMessages(message);
}else if(!data.success && data.message){ //Invalid token
Expand All @@ -55,7 +55,7 @@
if(mail1.length && mail2.length){
if(mail1 != mail2){
var message = {
'error' : [ Joomla.JText._('COM_USERS_PROFILE_EMAIL2_MESSAGE') ]
'warning' : [ Joomla.JText._('COM_USERS_PROFILE_EMAIL2_MESSAGE') ]
};
Joomla.renderMessages(message);
}
Expand All @@ -68,7 +68,7 @@
if(pass1.length && pass2.length){
if(pass1 != pass2){
var message = {
'error' : [ Joomla.JText._('COM_USERS_FIELD_RESET_PASSWORD1_MESSAGE')]
'warning' : [ Joomla.JText._('COM_USERS_FIELD_RESET_PASSWORD1_MESSAGE')]
};
Joomla.renderMessages(message);
}
Expand Down

0 comments on commit aa73579

Please sign in to comment.