angular - 在新标签页中打开重定向到登录页面
问题描述
我正在尝试在新标签中打开我的屏幕。它总是将我重定向到登录屏幕。我应该怎么做才能让用户在新标签页中打开?
我尝试在登录期间更新我的 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;
});
}
解决方案
推荐阅读
- assembly - AVX-512 中的压缩和扩展指令有什么区别?
- vba - 如何在运行时向用户窗体添加无边框文本框
- c++ - Qt 和 C++ 如何共享类中的项目
- visual-studio - 将项目/解决方案从 VS2015 复制到 VS2017
- jenkins - 使用 Jenkins 构建 MS 的 SonarQube 扫描仪在最后一步失败
- python - pyodbc 控制台错误消息
- java - 如何从 Serviceclass 正确调用 Spring Boot 工具类中的方法?
- session-cookies - Drupal 8 CiviCRM 创建用户无效会话密钥
- javascript - Slick Slider 停止循环
- gitlab - 通过 gitlab 提交代码,但我的本地代码未更新