Fixed self host defect (#3094)
This commit is contained in:
parent
0a06ae0ec5
commit
6a26223f93
|
@ -1,5 +1,5 @@
|
||||||
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
import { Directive, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
import { FormBuilder, Validators } from "@angular/forms";
|
import { AbstractControl, FormBuilder, ValidatorFn, Validators } from "@angular/forms";
|
||||||
import { Router } from "@angular/router";
|
import { Router } from "@angular/router";
|
||||||
|
|
||||||
import { InputsFieldMatch } from "@bitwarden/angular/validators/inputsFieldMatch.validator";
|
import { InputsFieldMatch } from "@bitwarden/angular/validators/inputsFieldMatch.validator";
|
||||||
|
@ -50,7 +50,7 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
acceptPolicies: [false, [Validators.requiredTrue]],
|
acceptPolicies: [false, [this.acceptPoliciesValidation()]],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: InputsFieldMatch.validateFormInputsMatch(
|
validator: InputsFieldMatch.validateFormInputsMatch(
|
||||||
|
@ -275,4 +275,13 @@ export class RegisterComponent extends CaptchaProtectedComponent implements OnIn
|
||||||
const name = error.errorName.charAt(0).toUpperCase() + error.errorName.slice(1);
|
const name = error.errorName.charAt(0).toUpperCase() + error.errorName.slice(1);
|
||||||
return `${error.controlName}${name}`;
|
return `${error.controlName}${name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//validation would be ignored on selfhosted
|
||||||
|
private acceptPoliciesValidation(): ValidatorFn {
|
||||||
|
return (control: AbstractControl) => {
|
||||||
|
const ctrlValue = control.value;
|
||||||
|
|
||||||
|
return !ctrlValue && this.showTerms ? { required: true } : null;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue