注销节点红色仪表板模板按钮

问题描述 投票:0回答:1

我有一个节点红色仪表板应用程序,我想注销。我为adminAuth,httpNodeAuth和https key / cert设置了settings.js。我正在使用模板,并希望包含一个注销按钮。我试过了:

    scope.logOut = function() {
        $.ajax({
            type: "GET",
            url: '/ui',
            dataType: 'json',
            async: true,
            username: "logout",
            password: "logout",
            data: '{ "comment" }'
        })

        //In our case, we WANT to get access denied, so a success would be a failure.
        .done(function(){
            alert('Error!')
        })

        //Likewise, a failure *usually* means we succeeded.
        //set window.location to redirect the user to wherever you want them to go
        .fail(function(){
            window.location = "/ui";
        });
    }

这将重新提示用户名和密码,但是如果我只是点击后退按钮,我就会重新登录应用程序而不登录。我将完全注销并跨浏览器生效。

node-red
1个回答
0
投票

请参阅:How to log out user from web site using BASIC authentication?

简而言之,很难从基本身份验证中正确注销,因为基本身份验证并非真正用于支持它。正如您在问题中提出的那样,有一些解决方法,但它们有缺点。

虽然node-red-dashboard仅支持基本身份验证,但您的选项将受到限制。我们希望能够提供更集成的身份验证机制,但它不是正在进行的工作。

© www.soinside.com 2019 - 2024. All rights reserved.