Skip to content

Commit

Permalink
DXCDT-302: Fix prompts update failing for non-login prompt types (#584)
Browse files Browse the repository at this point in the history
Fixing prompts update command

Co-authored-by: Will Vedder <[email protected]>
  • Loading branch information
willvedd and willvedd authored Jan 9, 2023
1 parent 3056670 commit faf1e06
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 3 deletions.
9 changes: 6 additions & 3 deletions internal/cli/prompts_custom_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,12 @@ func downloadDefaultBrandingTextTranslations(prompt, language string) map[string
return nil
}

selectedPrompt := allPrompts[0][prompt].(map[string]interface{})

return selectedPrompt
for _, value := range allPrompts {
_, ok := value[prompt]
if ok {
return value[prompt].(map[string]interface{})
}
}
}

return nil
Expand Down
40 changes: 40 additions & 0 deletions test/integration/fixtures/update-ul-prompts-login.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"login": {
"pageTitle": "Log in | ${clientName}",
"title": "Welcome",
"description": "Log in to ${companyName} to continue to ${clientName}.",
"separatorText": "Or",
"buttonText": "Continue",
"federatedConnectionButtonText": "Continue with ${connectionName}",
"footerLinkText": "Sign up",
"signupActionLinkText": "${footerLinkText}",
"footerText": "Don't have an account?",
"signupActionText": "${footerText}",
"forgotPasswordText": "Forgot password?",
"passwordPlaceholder": "Password",
"usernamePlaceholder": "Username or email address",
"emailPlaceholder": "Email address",
"editEmailText": "Edit",
"alertListTitle": "Alerts",
"invitationTitle": "You've Been Invited!",
"invitationDescription": "Log in to accept ${inviterName}'s invitation to join ${companyName} on ${clientName}.",
"logoAltText": "${companyName}",
"showPasswordText": "Show password",
"hidePasswordText": "Hide password",
"wrong-credentials": "Wrong username or password",
"invalid-email-format": "Email is not valid.",
"wrong-email-credentials": "Wrong email or password",
"custom-script-error-code": "Something went wrong, please try again later.",
"auth0-users-validation": "Something went wrong, please try again later",
"authentication-failure": "We are sorry, something went wrong when attempting to login",
"invalid-connection": "Invalid connection",
"ip-blocked": "We have detected suspicious login behavior and further attempts will be blocked. Please contact the administrator.",
"no-db-connection": "Invalid connection",
"password-breached": "We have detected a potential security issue with this account. To protect your account, we have prevented this login. Please reset your password to proceed.",
"user-blocked": "Your account has been blocked after multiple consecutive login attempts.",
"same-user-login": "Too many login attempts for this user. Please wait, and try again later.",
"no-email": "Please enter an email address",
"no-password": "Password is required",
"no-username": "Username is required"
}
}
64 changes: 64 additions & 0 deletions test/integration/fixtures/update-ul-prompts-mfa-push.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"mfa-push-welcome": {
"pageTitle": "Install the application | ${clientName}",
"title": "Secure Your Account",
"description": "In order to continue, install the ${appName} app via the app store from your mobile device.",
"androidButtonText": "Google Play",
"buttonText": "Continue",
"iosButtonText": "App Store",
"pickAuthenticatorText": "Try another method",
"logoAltText": "${companyName}"
},
"mfa-push-enrollment-qr": {
"pageTitle": "Scan the code to log in using a push notification | ${clientName}",
"title": "Secure Your Account",
"description": "Scan the QR Code below using the ${appName} app on your mobile device.",
"pickAuthenticatorText": "Try another method",
"buttonText": "Continue",
"logoAltText": "${companyName}",
"enrollment-transaction-pending": "You must scan the QR code with the ${appName} app on your mobile device."
},
"mfa-push-enrollment-code": {
"pageTitle": "Copy the code to log in using a push notification | ${clientName}",
"buttonText": "Continue",
"altText": "Secure code to copy",
"copyCodeButtonText": "Copy Code",
"instructions1": "Open the ${appName} app on your phone and tap \"+\" button.",
"instructions2": "Select Add account manually",
"instructions3": "Copy & paste this code to that screen",
"title": "Trouble scanning?",
"logoAltText": "${companyName}"
},
"mfa-push-success": {
"pageTitle": "Device registration successful | ${clientName}",
"title": "You're All Set!",
"buttonText": "Continue",
"description": "We’re redirecting you to ${clientName} now. If you’re not redirected automatically, you can manually redirect yourself below."
},
"mfa-push-challenge-push": {
"pageTitle": "Accept the push notification to log in | ${clientName}",
"title": "Verify Your Identity",
"description": "We’ve sent a notification to the following device via the ${appName} app:",
"buttonText": "I've responded on my device",
"pickAuthenticatorText": "Try another method",
"rememberMeText": "Remember this device for 30 days",
"resendActionText": "Resend",
"resendText": "Didn't receive a notification?",
"enterOtpCode": "Manually Enter Code",
"separatorText": "OR",
"logoAltText": "${companyName}",
"challenge-transaction-pending": "You must accept the notification via the ${appName} app on your mobile device.",
"polling-interval-exceeded": "We have not received a confirmation, please slow down.",
"too-many-push": "We have received too many notification requests. Wait a few minutes and try again.",
"transaction-not-found": "Your enrollment transaction expired, you will need to start again.",
"mfa-push-verify-transaction-pending": "We have not received a confirmation, please try scanning the code again.",
"mfa-push-verify-authenticator-error": "We couldn't verify the enrollment. Please try again later.",
"mfa-push-challenge-authenticator-error": "We couldn't send the notification. Please try again later.",
"transaction-rejected": "Notification rejected"
},
"mfa-push-list": {
"pageTitle": "List of available devices | ${clientName}",
"backText": "Go back",
"title": "Registered Devices"
}
}
8 changes: 8 additions & 0 deletions test/integration/test-cases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -710,3 +710,11 @@ tests:
display_name: "Integration Test Updated Organization"
branding.colors.page_background: "#AA1166"
branding.colors.primary: "#00FFAA"

update universal login branding prompts (login):
command: cat ./test/integration/fixtures/update-ul-prompts-login.json | auth0 ul prompts update login
exit-code: 0

update universal login branding prompts (mfa-push):
command: cat ./test/integration/fixtures/update-ul-prompts-mfa-push.json | auth0 ul prompts update mfa-push
exit-code: 0

0 comments on commit faf1e06

Please sign in to comment.