67 lines
2.9 KiB
PowerShell
67 lines
2.9 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
function ConvertFrom-Utf8Base64 {
|
|
param([string]$Value)
|
|
return [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($Value))
|
|
}
|
|
|
|
function Assert-Contains {
|
|
param([string]$Content, [string]$Expected, [string]$Message)
|
|
if ($Content -notmatch [regex]::Escape($Expected)) { throw $Message }
|
|
}
|
|
|
|
function Assert-NotContains {
|
|
param([string]$Content, [string]$Unexpected, [string]$Message)
|
|
if ($Content -match [regex]::Escape($Unexpected)) { throw $Message }
|
|
}
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$pagePath = Join-Path $root 'pages/auth/a05-reset-password.vue'
|
|
$pages = Get-Content -LiteralPath (Join-Path $root 'pages.json') -Raw -Encoding utf8 | ConvertFrom-Json
|
|
$catalog = Get-Content -LiteralPath (Join-Path $root 'data/page-catalog.js') -Raw -Encoding utf8
|
|
$page = Get-Content -LiteralPath $pagePath -Raw -Encoding utf8
|
|
$resetCopy = ConvertFrom-Utf8Base64 '6YeN6K6+5a+G56CB'
|
|
$confirmPasswordCopy = ConvertFrom-Utf8Base64 '56Gu6K6k5paw5a+G56CB'
|
|
$getCodeCopy = ConvertFrom-Utf8Base64 '6I635Y+W6aqM6K+B56CB'
|
|
$loginCopy = ConvertFrom-Utf8Base64 '6L+U5Zue55m75b2V'
|
|
|
|
if (-not ($pages.pages.path -contains 'pages/auth/a05-reset-password')) { throw 'A-05 route must remain declared in pages.json' }
|
|
Assert-NotContains -Content $page -Unexpected 'ModulePage' -Message 'A-05 must not remain a ModulePage shell'
|
|
foreach ($required in @(
|
|
'auth-header',
|
|
'reset-panel__skin',
|
|
'a02-login-panel.png',
|
|
'a01-primary-button.png',
|
|
'auth-divider-knot.png',
|
|
'chevron-right.png',
|
|
'v-model.trim="phone"',
|
|
'v-model.trim="verificationCode"',
|
|
'v-model="password"',
|
|
'v-model="confirmPassword"',
|
|
'const prepareGetCode = () =>',
|
|
'const submitReset = () =>',
|
|
"const prepareLogin = () => uni.navigateTo({ url: '/pages/auth/a02-login' })",
|
|
'if (!/^1\d{10}$/.test(phone.value))',
|
|
'if (!/^\d{6}$/.test(verificationCode.value))',
|
|
'if (!password.value)',
|
|
'if (password.value !== confirmPassword.value)'
|
|
)) {
|
|
Assert-Contains -Content $page -Expected $required -Message "Missing A-05 reset-password contract: $required"
|
|
}
|
|
Assert-Contains -Content $page -Expected $resetCopy -Message 'A-05 must visibly identify the password-reset task'
|
|
Assert-Contains -Content $page -Expected $confirmPasswordCopy -Message 'A-05 must require password confirmation'
|
|
Assert-Contains -Content $page -Expected $getCodeCopy -Message 'A-05 must expose the verification-code action'
|
|
Assert-Contains -Content $page -Expected $loginCopy -Message 'A-05 must provide the A02 return path'
|
|
Assert-NotContains -Content $catalog -Unexpected 'a05:' -Message 'A-05 must not remain in the temporary page catalog'
|
|
|
|
foreach ($forbidden in @(
|
|
'(?s)\.reset-panel\s*\{[^}]*\bborder\s*:',
|
|
'(?s)\.reset-panel\s*\{[^}]*\bbackground\s*:',
|
|
'(?s)\.reset-submit\s*\{[^}]*\bborder\s*:',
|
|
'(?s)\.reset-submit\s*\{[^}]*\bbackground\s*:'
|
|
)) {
|
|
if ($page -match $forbidden) { throw "A-05 retains forbidden CSS visual construction: $forbidden" }
|
|
}
|
|
|
|
Write-Output 'A05-RESET-PASSWORD-CONTRACT PASS'
|