Inserted a test that if the password is less than 8 charcters it will throw an exception (as does the WebAPI)

This commit is contained in:
Frank Geisler 2023-06-29 12:02:18 +02:00
parent 0230e9c97b
commit 11d879288c
2 changed files with 6 additions and 1 deletions

View file

@ -8,7 +8,7 @@
"[markdown]": {
"editor.wordwrap": "on",
"editor.renderWhitespace": "all",
"editor.acceptSuggestionOnEnter": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.rulers": [80],
"editor.trimAutoWhitespace": false
}

View file

@ -123,6 +123,7 @@ function New-SnipeitUser() {
[string]$apiKey
)
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -131,6 +132,10 @@ function New-SnipeitUser() {
$Values['password_confirmation'] = $password
}
if ($password.Length -lt 8) {
Throw "[$($MyInvocation.MyCommand.Name)] The password must be at least 8 characters."
}
$Parameters = @{
Api = "/api/v1/users"
Method = 'post'