diff --git a/src/app/organizations/manage/policy-edit.component.html b/src/app/organizations/manage/policy-edit.component.html
index 6bec1e7b43..ae3576233d 100644
--- a/src/app/organizations/manage/policy-edit.component.html
+++ b/src/app/organizations/manage/policy-edit.component.html
@@ -20,6 +20,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/src/app/organizations/manage/policy-edit.component.ts b/src/app/organizations/manage/policy-edit.component.ts
index 8bbd895923..4f0688aa29 100644
--- a/src/app/organizations/manage/policy-edit.component.ts
+++ b/src/app/organizations/manage/policy-edit.component.ts
@@ -31,10 +31,27 @@ export class PolicyEditComponent implements OnInit {
@Input() organizationId: string;
@Output() onSavedPolicy = new EventEmitter();
+ policyType = PolicyType;
loading = true;
enabled = false;
formPromise: Promise;
+ // Master password
+
+ masterPassMinLength?: number;
+
+ // TODO
+
+ // Password generator
+
+ passGenMinLength?: number;
+ passGenMinNumbers?: number;
+ passGenMinSpecial?: number;
+ passGenUseNumbers?: boolean;
+ passGenUseSpecial?: boolean;
+ passGenUseUpper?: boolean;
+ passGenUseLower?: boolean;
+
private policy: PolicyResponse;
constructor(private apiService: ApiService, private i18nService: I18nService,
@@ -49,7 +66,28 @@ export class PolicyEditComponent implements OnInit {
async load() {
try {
this.policy = await this.apiService.getPolicy(this.organizationId, this.type);
- this.enabled = this.policy.enabled;
+
+ if (this.policy != null) {
+ this.enabled = this.policy.enabled;
+ if (this.policy.data != null) {
+ switch (this.type) {
+ case PolicyType.PasswordGenerator:
+ this.passGenMinLength = this.policy.data.minLength;
+ this.passGenMinNumbers = this.policy.data.minNumbers;
+ this.passGenMinSpecial = this.policy.data.minSpecial;
+ this.passGenUseLower = this.policy.data.useLower;
+ this.passGenUseUpper = this.policy.data.useUpper;
+ this.passGenUseSpecial = this.policy.data.useSpecial;
+ this.passGenUseNumbers = this.policy.data.useNumbers;
+ break;
+ case PolicyType.MasterPassword:
+ this.masterPassMinLength = this.policy.data.minLength;
+ break;
+ default:
+ break;
+ }
+ }
+ }
} catch (e) {
if (e.statusCode === 404) {
this.enabled = false;
@@ -64,6 +102,26 @@ export class PolicyEditComponent implements OnInit {
request.enabled = this.enabled;
request.type = this.type;
request.data = null;
+ switch (this.type) {
+ case PolicyType.PasswordGenerator:
+ request.data = {
+ minLength: this.passGenMinLength,
+ minNumbers: this.passGenMinNumbers,
+ minSpecial: this.passGenMinSpecial,
+ useNumbers: this.passGenUseNumbers,
+ useSpecial: this.passGenUseSpecial,
+ useLower: this.passGenUseLower,
+ useUpper: this.passGenUseUpper,
+ };
+ break;
+ case PolicyType.MasterPassword:
+ request.data = {
+ minLength: this.masterPassMinLength,
+ };
+ break;
+ default:
+ break;
+ }
try {
this.formPromise = this.apiService.putPolicy(this.organizationId, this.type, request);
await this.formPromise;
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index dabee692e0..fc469ab7fd 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -2953,5 +2953,8 @@
},
"manageSubscriptionFromStore": {
"message": "You must manage your subscription from the store where your in-app purchase was made."
+ },
+ "minLength": {
+ "message": "Minimum Length"
}
}