mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-15 02:35:47 +00:00
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:
parent
0230e9c97b
commit
11d879288c
2 changed files with 6 additions and 1 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -8,7 +8,7 @@
|
|||
"[markdown]": {
|
||||
"editor.wordwrap": "on",
|
||||
"editor.renderWhitespace": "all",
|
||||
"editor.acceptSuggestionOnEnter": false,
|
||||
"editor.acceptSuggestionOnEnter": "off",
|
||||
"editor.rulers": [80],
|
||||
"editor.trimAutoWhitespace": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue