forked from OpenWF/SpaceNinjaServer
		
	fix: "logged in elsewhere" when logging in on account created via webui
This commit is contained in:
		
							parent
							
								
									daacbf6f7b
								
							
						
					
					
						commit
						547f7cb61d
					
				@ -21,7 +21,11 @@ export const loginController: RequestHandler = async (request, response) => {
 | 
			
		||||
 | 
			
		||||
    const myAddress = request.host.indexOf("warframe.com") == -1 ? request.host : config.myAddress;
 | 
			
		||||
 | 
			
		||||
    if (!account && config.autoCreateAccount && loginRequest.ClientType != "webui") {
 | 
			
		||||
    if (
 | 
			
		||||
        !account &&
 | 
			
		||||
        ((config.autoCreateAccount && loginRequest.ClientType != "webui") ||
 | 
			
		||||
            loginRequest.ClientType == "webui-register")
 | 
			
		||||
    ) {
 | 
			
		||||
        try {
 | 
			
		||||
            const nameFromEmail = loginRequest.email.substring(0, loginRequest.email.indexOf("@"));
 | 
			
		||||
            let name = nameFromEmail || loginRequest.email.substring(1) || "SpaceNinja";
 | 
			
		||||
@ -37,7 +41,7 @@ export const loginController: RequestHandler = async (request, response) => {
 | 
			
		||||
                password: loginRequest.password,
 | 
			
		||||
                DisplayName: name,
 | 
			
		||||
                CountryCode: loginRequest.lang.toUpperCase(),
 | 
			
		||||
                ClientType: loginRequest.ClientType,
 | 
			
		||||
                ClientType: loginRequest.ClientType == "webui-register" ? "webui" : loginRequest.ClientType,
 | 
			
		||||
                CrossPlatformAllowed: true,
 | 
			
		||||
                ForceLogoutVersion: 0,
 | 
			
		||||
                ConsentNeeded: false,
 | 
			
		||||
@ -59,6 +63,11 @@ export const loginController: RequestHandler = async (request, response) => {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (loginRequest.ClientType == "webui-register") {
 | 
			
		||||
        response.status(400).json({ error: "account already exists" });
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!isCorrectPassword(loginRequest.password, account.password)) {
 | 
			
		||||
        response.status(400).json({ error: "incorrect login data" });
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
@ -44,7 +44,7 @@ function doLoginRequest(succ_cb, fail_cb) {
 | 
			
		||||
            s: "W0RFXVN0ZXZlIGxpa2VzIGJpZyBidXR0cw==", // signature of some kind
 | 
			
		||||
            lang: "en",
 | 
			
		||||
            date: 1501230947855458660, // ???
 | 
			
		||||
            ClientType: registerSubmit ? "" : "webui",
 | 
			
		||||
            ClientType: registerSubmit ? "webui-register" : "webui",
 | 
			
		||||
            PS: "W0RFXVN0ZXZlIGxpa2VzIGJpZyBidXR0cw==" // anti-cheat data
 | 
			
		||||
        })
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user