Browse Source

Fixes #907: unnecessary validation error

JC Brand 7 years ago
parent
commit
734991f1ce
2 changed files with 8 additions and 1 deletions
  1. 1 0
      CHANGES.md
  2. 7 1
      src/converse-controlbox.js

+ 1 - 0
CHANGES.md

@@ -4,6 +4,7 @@
 
 
 ### Bugfixes
 ### Bugfixes
 - Various IE11 fixes.
 - Various IE11 fixes.
+- #907 Unnecessary login validation error when `default_domain` or `locked_domain` are set.
 - #908 Login form for inVerse is only 200px when `allow_registration` is set to `false`.
 - #908 Login form for inVerse is only 200px when `allow_registration` is set to `false`.
 - #909 Translations written as template literals [aren't parsed properly by xgettext](https://savannah.gnu.org/bugs/?50920).
 - #909 Translations written as template literals [aren't parsed properly by xgettext](https://savannah.gnu.org/bugs/?50920).
 - #911 Use `getDefaultNickName` consistently to allow better overrides via plugins.
 - #911 Use `getDefaultNickName` consistently to allow better overrides via plugins.

+ 7 - 1
src/converse-controlbox.js

@@ -405,6 +405,8 @@
                 },
                 },
 
 
                 authenticate (ev) {
                 authenticate (ev) {
+                    /* Authenticate the user based on a form submission event.
+                     */
                     if (ev && ev.preventDefault) { ev.preventDefault(); }
                     if (ev && ev.preventDefault) { ev.preventDefault(); }
                     const $form = $(ev.target);
                     const $form = $(ev.target);
                     if (_converse.authentication === _converse.ANONYMOUS) {
                     if (_converse.authentication === _converse.ANONYMOUS) {
@@ -418,10 +420,14 @@
                     let jid = $jid_input.val(),
                     let jid = $jid_input.val(),
                         errors = false;
                         errors = false;
 
 
-                    if (!jid || _.filter(jid.split('@')).length < 2) {
+                    if (!jid || (
+                            !_converse.locked_domain &&
+                            !_converse.default_domain &&
+                            _.filter(jid.split('@')).length < 2)) {
                         errors = true;
                         errors = true;
                         $jid_input.addClass('error');
                         $jid_input.addClass('error');
                     }
                     }
+
                     if (!password && _converse.authentication !== _converse.EXTERNAL)  {
                     if (!password && _converse.authentication !== _converse.EXTERNAL)  {
                         errors = true;
                         errors = true;
                         $pw_input.addClass('error');
                         $pw_input.addClass('error');