Skip to content

Node.js based forum software built for the modern web

closes #6890

Barış Soner Uşaklı8ca36ad12279
diff --git a/src/database/mongo.js b/src/database/mongo.js
index 47964fdd0d..3f528d15ae 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -64,9 +64,10 @@ mongoModule.helpers.mongo = require('./mongo/helpers');
mongoModule.getConnectionString = function () {
var usernamePassword = '';
+ var uri = nconf.get('mongo:uri');
if (nconf.get('mongo:username') && nconf.get('mongo:password')) {
usernamePassword = nconf.get('mongo:username') + ':' + encodeURIComponent(nconf.get('mongo:password')) + '@';
- } else {
+ } else if (!uri.includes('@') || !uri.slice(uri.indexOf('://') + 3, uri.indexOf('@'))) {
winston.warn('You have no mongo username/password setup!');
}