25 lines
955 B
PowerShell
25 lines
955 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$owner = 'utils/validation.js'
|
|
if (-not (Test-Path $owner)) { throw 'Missing shared password policy owner' }
|
|
$validation = Get-Content $owner -Raw -Encoding UTF8
|
|
foreach ($token in @('export const PASSWORD_POLICY_MESSAGE', 'export const validatePassword')) {
|
|
if (-not $validation.Contains($token)) { throw "Password policy owner missing: $token" }
|
|
}
|
|
|
|
foreach ($page in @(
|
|
'pages/auth/a04-register.vue',
|
|
'pages/auth/a05-reset-password.vue',
|
|
'pages/profile/m04-change-password.vue'
|
|
)) {
|
|
$source = Get-Content $page -Raw -Encoding UTF8
|
|
foreach ($token in @('validatePassword', 'PASSWORD_POLICY_MESSAGE', '@/utils/validation.js')) {
|
|
if (-not $source.Contains($token)) { throw "$page does not consume shared password policy: $token" }
|
|
}
|
|
if ($source -match '\(\?=\.\*\[A-Za-z\]\)|\{8,32\}\$') {
|
|
throw "$page must not own a local password policy regex"
|
|
}
|
|
}
|
|
|
|
Write-Output 'PASSWORD-POLICY-CONTRACT PASS'
|