mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-16 06:24:00 +02:00
Cleaner code
This commit is contained in:
parent
9fd819d608
commit
472968e81d
1 changed files with 3 additions and 7 deletions
|
@ -32,14 +32,10 @@ function userLogin(client, username, password, cb) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ensure this user is not already logged in.
|
// Ensure this user is not already logged in.
|
||||||
// Loop through active connections -- which includes the current --
|
|
||||||
// and check for matching user ID. If the count is > 1, disallow.
|
|
||||||
//
|
//
|
||||||
let existingClientConnection;
|
const existingClientConnection = clientConnections.find(cc => {
|
||||||
clientConnections.forEach(function connEntry(cc) {
|
return user !== cc.user && // not current connection
|
||||||
if(cc.user !== user && cc.user.userId === user.userId) {
|
user.userId === cc.user.userId; // ...but same user
|
||||||
existingClientConnection = cc;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(existingClientConnection) {
|
if(existingClientConnection) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue