Prechádzať zdrojové kódy

Fixed Can't login via LDAP because of some Node.js issues.

Thanks to Danny-Graf and xet7 !

Fixes #5113
Lauri Ojansivu 1 rok pred
rodič
commit
c898a3f5ea
1 zmenil súbory, kde vykonal 12 pridanie a 8 odobranie
  1. 12 8
      packages/wekan-ldap/server/ldap.js

+ 12 - 8
packages/wekan-ldap/server/ldap.js

@@ -4,15 +4,19 @@ import { Log } from 'meteor/logging'
 
 // copied from https://github.com/ldapjs/node-ldapjs/blob/a113953e0d91211eb945d2a3952c84b7af6de41c/lib/filters/index.js#L167
 function escapedToHex (str) {
-  return str.replace(/\\([0-9a-f][^0-9a-f]|[0-9a-f]$|[^0-9a-f]|$)/gi, function (match, p1) {
-    if (!p1) {
-      return '\\5c';
-    }
+  if (str !== undefined) {
+    return str.replace(/\\([0-9a-f][^0-9a-f]|[0-9a-f]$|[^0-9a-f]|$)/gi, function (match, p1) {
+      if (!p1) {
+        return '\\5c';
+      }
 
-    const hexCode = p1.charCodeAt(0).toString(16);
-    const rest = p1.substring(1);
-    return '\\' + hexCode + rest;
-  });
+      const hexCode = p1.charCodeAt(0).toString(16);
+      const rest = p1.substring(1);
+      return '\\' + hexCode + rest;
+    });
+  } else {
+    return undefined;
+  }
 }
 
 export default class LDAP {