Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch-service.jsx file is corrupted (validation issue with new-udinput) #1350

Closed
wsl2001 opened this issue Dec 5, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@wsl2001
Copy link

wsl2001 commented Dec 5, 2019

Up to version 2.7.0 whenever you use validation with new-udinput, the moment you click on the second box the green circle will spin and do the validate and provide the error message as expected.

recently with nightly builds the green circle will spin and nothing like what you have entered is valid, then when you click submit you get the validation error.

based on my testing the issue is in the client folder cause when i replace client folder with an older version or with the current one from 2.7.0 it works again.

here is a sample

Get-UDDashboard | Stop-UDDashboard

Start-UDDashboard -Dashboard (
New-UDDashboard -Title "Test" -Content {

New-UDInput -Title 'Restore Staging DBs' -SubmitText 'Continue' -Content {

New-UDInputField -Type 'textbox' -Name 'UserName' -Placeholder 'User Name'
New-UDInputField -Type 'password' -Name 'password' -Placeholder 'Password'


} -Endpoint {


    param(
        [Parameter(Mandatory = $True)]
        [UniversalDashboard.ValidationErrorMessage("UserName is inavalid or you don't have rights, please check!")]
        [ValidateScript( {

                $Members = Get-ADGroupMember -Identity 'Test' -Recursive | Select -ExpandProperty SamAccountName

                if ($Members -contains $_) {

                    $True 
                    $Session:U = $_
                }
                else { Throw "error" }

            })]

        $UserName,

        [Parameter(Mandatory = $True)]
        [UniversalDashboard.ValidationErrorMessage("Password is inavalid, please check!")]
        [ValidateScript( {
                Add-Type -AssemblyName System.DirectoryServices.AccountManagement
                $obj = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain', 'lms.local')
                if (($obj.ValidateCredentials($Session:U, $_)) -eq $True) {

                    $True 
                }
                else { Throw "error" }

            })]

        $Password
        )

        } -Validate
        }

) -Port 80 -wait

image

@wsl2001 wsl2001 added the bug Something isn't working label Dec 5, 2019
@wsl2001
Copy link
Author

wsl2001 commented Dec 6, 2019

the following line : var jsonresponse = response.json; needs to be var jsonresponse = response.json();

BoSen29 added a commit to BoSen29/universal-dashboard that referenced this issue Dec 6, 2019
A previous typo of mine...
@BoSen29
Copy link
Contributor

BoSen29 commented Dec 6, 2019

#1352
PR in, reading through previous editions of this file i noticed my typo on the last PR. Apologies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants