mirror of
				https://github.com/louislam/uptime-kuma.git
				synced 2025-11-04 13:46:13 +08:00 
			
		
		
		
	improve disableAuth handling
This commit is contained in:
		@@ -58,7 +58,8 @@ export default {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        socket.on("autoLogin", (monitorID, data) => {
 | 
					        socket.on("autoLogin", (monitorID, data) => {
 | 
				
			||||||
            this.loggedIn = true;
 | 
					            this.loggedIn = true;
 | 
				
			||||||
            this.storage().token = "autoLogin"
 | 
					            this.storage().token = "autoLogin";
 | 
				
			||||||
 | 
					            this.allowLoginDialog = false;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        socket.on("monitorList", (data) => {
 | 
					        socket.on("monitorList", (data) => {
 | 
				
			||||||
@@ -166,6 +167,16 @@ export default {
 | 
				
			|||||||
            if (token) {
 | 
					            if (token) {
 | 
				
			||||||
                if (token !== "autoLogin") {
 | 
					                if (token !== "autoLogin") {
 | 
				
			||||||
                    this.loginByToken(token)
 | 
					                    this.loginByToken(token)
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    // Timeout if it is not actually auto login
 | 
				
			||||||
 | 
					                    setTimeout(() => {
 | 
				
			||||||
 | 
					                        if (! this.loggedIn) {
 | 
				
			||||||
 | 
					                            this.allowLoginDialog = true;
 | 
				
			||||||
 | 
					                            this.$root.storage().removeItem("token");
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }, 5000);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                this.allowLoginDialog = true;
 | 
					                this.allowLoginDialog = true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -194,7 +194,7 @@ export default {
 | 
				
			|||||||
        enableAuth() {
 | 
					        enableAuth() {
 | 
				
			||||||
            this.settings.disableAuth = false;
 | 
					            this.settings.disableAuth = false;
 | 
				
			||||||
            this.saveSettings();
 | 
					            this.saveSettings();
 | 
				
			||||||
            this.$root.storage().token = null;
 | 
					            this.$root.storage().removeItem("token");
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user