首页 > 解决方案 > 在新标签页中打开重定向到登录页面

问题描述

我正在尝试在新标签中打开我的屏幕。它总是将我重定向到登录屏幕。我应该怎么做才能让用户在新标签页中打开?

我尝试在登录期间更新我的 localstorage 变量并在注销期间清除它。但这没有帮助。

这是我的 login.component :

login() {
    this.loading = true;
    this.setProvinceCode(this.model.province);
    this.authenticationError = false;
    this.validationMessage = "";

    this.authenticationService.login(this.model.username, this.model.password, this.model.province)
        .subscribe(
            (user: any) => {
                if (user && user.authenticated) {
                    if (this.rememberMe) {
                        this.appStorageService.setData(this.appStorageService.usernameKey, this.model.username);

                    } else {
                        this.appStorageService.removeData(this.appStorageService.usernameKey);
                    }

                    if (this.model.province !== 'BC') {
                        this.appStorageService.setData(this.appStorageService.mustChangePasswordInNextLoginKey, user.mustChangePasswordInNextLogin);
                    }

                }
                else if (user.message) {
                    this.validationMessage = user.message;
                }
                else {
                    this.authenticationError = true;
                }

                this.loading = false;
            },
            error => {
                this.alertService.error(error);
                this.loading = false;
            });
}

标签: angular

解决方案


推荐阅读