update checkUserExists and inconsistencies

This commit is contained in:
zefie
2022-02-09 23:49:17 -05:00
parent ccdf89c582
commit db1b03fd99
4 changed files with 14 additions and 7 deletions

View File

@@ -290,8 +290,8 @@ class WTVMail {
return icon_image;
}
checkUserExists(username) {
// returns the user's SSID if true, false if not
checkUserExists(username, directory = null) {
// returns the user's username if true, false if not
var username_match = false;
var search_dir = this.session_store_dir;
var return_val = false;
@@ -299,7 +299,7 @@ class WTVMail {
if (directory) search_dir = directory;
this.fs.readdirSync(search_dir).forEach(file => {
if (self.fs.lstatSync(search_dir + self.path.sep + file).isDirectory()) {
return self.checkUsernameAvailable(username, ssid_sessions, search_dir + self.path.sep + file);
return self.checkUserExists(username, search_dir + self.path.sep + file);
}
if (!file.match(/.*\.json/ig)) return;
if (username_match) return;