Skip to content

Commit 3447c2c

Browse files
tap copyFrom field
1 parent 52f1978 commit 3447c2c

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecCreateTAP.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Function Invoke-ExecCreateTAP {
1616
# Interact with query parameters or the body of the request.
1717
try {
1818
$TAP = New-CIPPTAP -userid $Request.query.ID -TenantFilter $Request.query.tenantfilter -APIName $APINAME -ExecutingUser $request.headers.'x-ms-client-principal'
19-
$Results = [pscustomobject]@{'Results' = "$TAP" }
19+
$Results = [pscustomobject]@{'Results' = $TAP }
2020
} catch {
2121
$Results = [pscustomobject]@{'Results' = "Failed. $($_.Exception.Message)" }
2222
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecResetPass.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Function Invoke-ExecResetPass {
2323

2424
try {
2525
$Reset = Set-CIPPResetPassword -userid $Request.query.ID -tenantFilter $TenantFilter -APIName $APINAME -ExecutingUser $request.headers.'x-ms-client-principal' -forceChangePasswordNextSignIn $mustChange
26-
$Results = [pscustomobject]@{'Results' = "$Reset" }
26+
$Results = [pscustomobject]@{'Results' = $Reset }
2727
} catch {
2828
$Results = [pscustomobject]@{'Results' = "Failed to reset password for $($Request.query.displayName): $($_.Exception.Message)" }
2929
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message "Failed to reset password for $($Request.query.displayName): $($_.Exception.Message)" -Sev 'Error'

Modules/CIPPCore/Public/New-CIPPTAP.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,19 @@ function New-CIPPTAP {
1111
try {
1212
$GraphRequest = New-GraphPostRequest -uri "https://graph.microsoft.com/beta/users/$($userid)/authentication/temporaryAccessPassMethods" -tenantid $TenantFilter -type POST -body '{}' -verbose
1313
Write-LogMessage -user $ExecutingUser -API $APIName -message "Created Temporary Access Password (TAP) for $userid" -Sev 'Info' -tenant $TenantFilter
14-
return "The TAP for this user is $($GraphRequest.temporaryAccessPass) - This TAP is usable for the next $($GraphRequest.LifetimeInMinutes) minutes"
14+
return [pscustomobject]@{ resultText = "The TAP for this user is $($GraphRequest.temporaryAccessPass) - This TAP is usable for the next $($GraphRequest.LifetimeInMinutes) minutes"
15+
copyField = $($GraphRequest.temporaryAccessPass)
16+
state = 'success'
17+
}
18+
1519
} catch {
1620
$ErrorMessage = Get-CippException -Exception $_
1721
Write-LogMessage -user $ExecutingUser -API $APIName -message "Failed to created TAP for $($userid): $($ErrorMessage.NormalizedError)" -Sev 'Error' -tenant $TenantFilter -LogData $ErrorMessage
18-
Return "Failed to create TAP: $($ErrorMessage.NormalizedError)"
22+
Return [pscustomobject]@{ resultText = "Failed to create TAP: $($ErrorMessage.NormalizedError)"
23+
state = 'error'
24+
}
25+
26+
1927
}
2028

2129
}

Modules/CIPPCore/Public/Set-CIPPResetPassword.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ function Set-CIPPResetPassword {
2626
$password = $PasswordLink
2727
}
2828
Write-LogMessage -user $ExecutingUser -API $APIName -message "Reset the password for $($userid). User must change password is set to $forceChangePasswordNextSignIn" -Sev 'Info' -tenant $TenantFilter
29-
30-
if($UserDetails.onPremisesSyncEnabled -eq $true){
31-
return "Reset the password for $($userid). User must change password is set to $forceChangePasswordNextSignIn. The new password is $password. WARNING: This user is AD synced. Please confirm passthrough or writeback is enabled."
32-
}else{
33-
return "Reset the password for $($userid). User must change password is set to $forceChangePasswordNextSignIn. The new password is $password"
29+
30+
if ($UserDetails.onPremisesSyncEnabled -eq $true) {
31+
return [pscustomobject]@{ resultText = "Reset the password for $($userid). User must change password is set to $forceChangePasswordNextSignIn. The new password is $password. WARNING: This user is AD synced. Please confirm passthrough or writeback is enabled."
32+
copyField = $password
33+
state = 'warning'
34+
}
35+
} else {
36+
return [pscustomobject]@{ resultText = "Reset the password for $($userid). User must change password is set to $forceChangePasswordNextSignIn. The new password is $password"
37+
copyField = $password
38+
state = 'success'
39+
}
3440
}
3541
} catch {
3642
$ErrorMessage = Get-CippException -Exception $_
3743
Write-LogMessage -user $ExecutingUser -API $APIName -message "Could not reset password for $($userid). Error: $($ErrorMessage.NormalizedError)" -Sev 'Error' -tenant $TenantFilter -LogData $ErrorMessage
38-
return "Could not reset password for $($userid). Error: $($ErrorMessage.NormalizedError)"
44+
return [pscustomobject]@{
45+
resultText = "Could not reset password for $($userid). Error: $($ErrorMessage.NormalizedError)"
46+
state = 'Error'
47+
}
3948
}
4049
}

0 commit comments

Comments
 (0)