Multiple logins from single account

Maybe you can control users with IPs.

import wixData from ‘wix-data’ ;
import { fetch } from ‘wix-fetch’ ;
import wixUsers from “wix-users” ;

let user = wixUsers . currentUser ;
let userId = user . id ;
let isLoggedIn = user . loggedIn ;

$w . onReady ( function () {

fetch ( "https://extreme-ip-lookup.com/json" , { 
        method :  "get" 
    }) 
    . then (( httpResponse ) => { 
        if  ( httpResponse . ok ) { 
            **return**  httpResponse . json (); 
        } 
    }) 
    . then (( json ) => { 
        const  ipaddress  =  json . query ; 
        //Inserting user ip to UserCollection 
        console . log ( ipaddress ) 
        if  ( isLoggedIn ) { 
            wixData . query ( "UserCollection" ) 
                . eq ( "userIp" ,  ipaddress ) 
                . find () 
                . then (( result ) => { 
                    if  ( result . length  >  0 ) { 
                        // if userIp exist in UserCollection 
                    }  **else**  { 
                        // if userIp not exist in UserCollection 
                        let  toInsert  = { 
                            userIp :  ipaddress , 
                            userId :  userId , 
                            first_name :  "John" , 
                            last_name :  "Doe" 
                        }; 

                        wixData 
                            . insert ( "UserCollection" ,  toInsert ) 
                            . then (( results ) => { 
                                let  item  =  results ;  //see item below 
                            }) 
                            . catch (( err ) => { 
                                let  errorMsg  =  err ; 
                            }); 
                    } 
                }); 
        }  **else**  { 
            //Login please 
        } 

        //User access 
        wixData . query ( "UserCollection" ) 
            . eq ( "userIp" ,  ipaddress ) 
            . find () 
            . then (( result ) => { 
                if  ( result . length  >  0 ) { 
                    if  ( result . items [ 0 ]. userId  ===  userId ) { 
                        //You can access 
                    }  **else**  { 
                        //You can't access 
                    } 
                }  **else**  { 
                    //Login please 
                } 
            }) 
    }); 

});