我的Angular登录表单在Google Chrome上被标记为“危险”

I have an angular app with a firebase backend that is getting marked as "dangerous" on google chrome when a login attempt is submitted but has the wrong password. I looked into the documentation here for chromium https://www.chromium.org/developers/design-documents/create-amazing-password-forms

所以我认为这可能与浏览器的需求有关

执行到另一个页面的导航。 要么 使用History.pushState或History.replaceState模拟导航,并完全删除密码表单。

有人遇到过吗?

提前致谢

这是我的html登录表单:

    <div class="form-group">
            <form [formGroup]="loginForm">
              <h3 class="cloudText">My App</h3>

              <p class="cloudText text-muted">Welcome Home</p>

              <!--email field with validation-->
              <div class="form-group">
                <div class="input-group mb-3">
                  <div class="input-group-prepend">
                    <span class="input-group-text"> @ </span>
                  </div>

                  <input
                    type="email"
                    class="inputTransparent form-control is-valid"
                    id="inputSuccess1"
                    formControlName="email"
                    placeholder="email"
                    name="email"
                    required
                    [ngClass]="{
                      'is-valid': loginForm.get('email').valid,
                      'is-invalid':
                        loginForm.get('email').invalid &&
                        (loginForm.get('email').dirty ||
                          loginForm.get('email').touched)
                    }"
                  />
                  <div
                    class="invalid-feedback"
                    *ngIf="
                      loginForm.get('email').invalid &&
                      (loginForm.get('email').dirty ||
                        loginForm.get('email').touched)
                    "
                  >
                    Invalid Email
                  </div>
                </div>
              </div>
              <!--End email field-->

              <!--password field with validation-->
              <div class="form-group">
                <div class="input-group mb-3">
                  <div class="input-group-prepend">
                    <span class="input-group-text"
                      ><i class="icon-lock"></i
                    ></span>
                  </div>

                  <input
                    type="password"
                    class="inputTransparent form-control is-valid"
                    id="inputSuccess1"
                    formControlName="password"
                    placeholder="Password"
                    autocomplete="current-password"
                    required
                    [ngClass]="{
                      'is-valid': loginForm.get('password').valid,
                      'is-invalid':
                        loginForm.get('password').invalid &&
                        (loginForm.get('password').dirty ||
                          loginForm.get('password').touched)
                    }"
                  />
                  <div
                    class="invalid-feedback"
                    *ngIf="
                      loginForm.get('password').invalid &&
                      (loginForm.get('password').dirty ||
                        loginForm.get('password').touched)
                    "
                  >
                    Enter a Password
                  </div>
                  <div class="invalid-feedback">
                    {{ errorMessage }}
                  </div>
                </div>
              </div>
              <!--End password field-->
              <!--password field with validation-->
              <div class="form-group">
                <div class="input-group mb-3">
                  <div
                    class="invalid-feedback"
                    *ngIf="
                      loginForm.get('password').invalid &&
                      (loginForm.get('password').dirty ||
                        loginForm.get('password').touched)
                    "
                  >
                    Enter Your password
                  </div>
                </div>
              </div>
              <!--End password field-->

              <div class="centerUp row">
                <div class="col-12">
                  <button
                    type="submit"
                    (click)="tryLogin(loginForm.value)"
                    class="btn btn-primary px-4"
                    [disabled]="loginForm.invalid"
                  >
                    Login
                  </button>

这是我的登录方法

 tryLogin(value) {
    this.authService.doLogin(value).then(
      (res) => {
        this.isEmailVerified = this.authService.getAuth().currentUser.emailVerified;

        if (!this.isEmailVerified) {
          this.verificationModal.show();
        }
        if (this.isEmailVerified) {
          let count = 0;
          this.mySub = this.authService
            .getUserInfo(res.user.uid)
            .subscribe((res3) => {
              res3.forEach((item) => {
                count = count + 1;
                this.mySub.unsubscribe();
                this.authService.setUserInfo(item);

                if (item.userProfileIsSet) {
                  this.router.navigate(["dashboard", item.username]);
                }

                if (!item.userProfileIsSet) {
                  this.router.navigate(["profileSetup"]);
                }
              });
              //this.router.navigate(['dashboard', this.authService.getCurrentUserId()]);
            });
        }
      },
      (err) => {
        this.hasError = true;
        console.log(err);
        this.errorMessage = err.message;

        switch (err.code) {
          case "auth/user-not-found": {
            console.log("This Email Does Not Exist in our system");
            this.errorMessage = "This Email Does Not Exist In Our System";
            break;
          }
          case "auth/invalid-email": {
            console.log("This Email Is Not Valid");
            this.errorMessage = "This Email is Invalid";
            break;
          }
          case "auth/too-many-requests": {
            console.log("This Email Is Not Valid");
            this.errorMessage =
              "Too many unsuccessful login attempts. Please try again later.";
            break;
          }
          case "auth/user-disabled": {
            console.log("This User is disabled");
            this.errorMessage = "This User Is Disabled";
            break;
          }
          case "auth/wrong-password": {
            console.log("This Password is incorrect");
            this.errorMessage = "Incorrect Password";
            break;
          }
          default: {
            this.errorMessage = "Unable to sign in Try again later";
            break;
          }
        }
      }
    );
  }
评论