Skip to content

Commit a9e4fdd

Browse files
committed
Revert change to public policy type and policy response
1 parent 8bcbb93 commit a9e4fdd

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

docs-devsite/auth.passwordpolicy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ List of characters that are considered non-alphanumeric during validation.
3232
<b>Signature:</b>
3333

3434
```typescript
35-
readonly allowedNonAlphanumericCharacters?: string[];
35+
readonly allowedNonAlphanumericCharacters: string[];
3636
```
3737

3838
## PasswordPolicy.customStrengthOptions

packages/auth/src/api/password_policy/get_password_policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface GetPasswordPolicyResponse {
4242
containsNumericCharacter?: boolean;
4343
containsNonAlphanumericCharacter?: boolean;
4444
};
45-
allowedNonAlphanumericCharacters?: string[];
45+
allowedNonAlphanumericCharacters: string[];
4646
schemaVersion: number;
4747
}
4848

packages/auth/src/core/auth/password_policy_impl.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ describe('core/auth/password_policy_impl', () => {
5151
minPasswordLength: TEST_MIN_PASSWORD_LENGTH,
5252
maxPasswordLength: TEST_MAX_PASSWORD_LENGTH
5353
},
54+
allowedNonAlphanumericCharacters: TEST_ALLOWED_NON_ALPHANUMERIC_CHARS,
5455
schemaVersion: TEST_SCHEMA_VERSION
5556
};
5657
const passwordPolicyRequireAll: PasswordPolicy = {
@@ -68,7 +69,8 @@ describe('core/auth/password_policy_impl', () => {
6869
customStrengthOptions: {
6970
minPasswordLength: TEST_MIN_PASSWORD_LENGTH,
7071
maxPasswordLength: TEST_MAX_PASSWORD_LENGTH
71-
}
72+
},
73+
allowedNonAlphanumericCharacters: TEST_ALLOWED_NON_ALPHANUMERIC_CHARS
7274
};
7375

7476
context('#PasswordPolicyImpl', () => {

packages/auth/src/core/auth/password_policy_impl.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { PasswordValidationStatus } from '../../model/public_types';
3030
*/
3131
export class PasswordPolicyImpl implements PasswordPolicyInternal {
3232
readonly customStrengthOptions: PasswordPolicyCustomStrengthOptions;
33-
readonly allowedNonAlphanumericCharacters?: string[];
33+
readonly allowedNonAlphanumericCharacters: string[];
3434
readonly schemaVersion: number;
3535

3636
constructor(response: GetPasswordPolicyResponse) {
@@ -62,10 +62,8 @@ export class PasswordPolicyImpl implements PasswordPolicyInternal {
6262
responseOptions.containsNonAlphanumericCharacter;
6363
}
6464

65-
if (response.allowedNonAlphanumericCharacters) {
66-
this.allowedNonAlphanumericCharacters =
67-
response.allowedNonAlphanumericCharacters;
68-
}
65+
this.allowedNonAlphanumericCharacters =
66+
response.allowedNonAlphanumericCharacters;
6967
this.schemaVersion = response.schemaVersion;
7068
}
7169

@@ -75,7 +73,7 @@ export class PasswordPolicyImpl implements PasswordPolicyInternal {
7573
passwordPolicy: this
7674
};
7775

78-
// TODO: Implement _checkLengthOptions and _checkCharacterOptions as helper methods.
76+
// TODO: Implement private helper methods for checking length and character options.
7977
// Call these here to populate the status object.
8078
if (password) {
8179
status.isValid = true;

packages/auth/src/model/public_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ export interface PasswordPolicy {
12911291
/**
12921292
* List of characters that are considered non-alphanumeric during validation.
12931293
*/
1294-
readonly allowedNonAlphanumericCharacters?: string[];
1294+
readonly allowedNonAlphanumericCharacters: string[];
12951295
}
12961296

12971297
/**

0 commit comments

Comments
 (0)