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

Make Theme defaultMessages optional #460

Closed
trollr opened this issue Jan 30, 2020 · 6 comments
Closed

Make Theme defaultMessages optional #460

trollr opened this issue Jan 30, 2020 · 6 comments
Assignees
Labels
support Further information is requested or user requires assistance working as designed

Comments

@trollr
Copy link

trollr commented Jan 30, 2020

Theme defaultMessages optional

Description

I try to clone the default theme via api.

"theme": {
    "sourceThemeId": "xxxxx",
    "name": "Orange Theme"
}

but need to set all defaultMessages to add a new theme.

Steps to reproduce

Add a new theme via api with following body:

"theme": {
    "sourceThemeId": "xxxxx",
    "name": "Orange Theme"
}

Result:

{
  "statusCode": 400,
  "errorResponse": {
    "fieldErrors": {
      "theme.defaultMessages": [
        {
          "code": "[invalid]theme.defaultMessages",
          "message": "You must specify all of the required keys in the [theme.defaultMessages] property. It is missing these keys: [PasswordlessDisabled], send-code-to-phone, parentEmail, loginId, [inactive]user.username, [couldNotConvert]user.birthDate, registration-verification-title, forgot-password-title, password, [PushTwoFactorFailed], [notEmail]user.email, sent-code, wait-title, send-another-code, [blank]user.password, [ForgotPasswordDisabled], passwordless-login, mobilePhone, dont-have-an-account, sign-in-as-different-user, complete-external-login, {tooltip}trustComputer, [blank]user.email, [blank]user.middleName, device-login-complete, [tooLong]user.password, lastName, password-length-constraint, [blank]passwordConfirm, [singleCase]user.password, login, userCode, [APIError], [ErrorException], parent-notified-title, [TwoFactorTimeout], forgot-password-email-sent-title, [OAuthv1TokenMismatch], [UserExpiredException], verify, [duplicate]user.username, email-verification-sent-title, email, [ExternalAuthenticationExpired], [blank]user_code, provide-parent-email, [PasswordChangeRequired], password-change-title, registration-verification-sent, [blank]user.lastName, return-to-login, password-case-constraint, forgot-password, help, [requireNumber]user.password, [InvalidIdentityProviderId], create-an-account, forgot-password-email-sent, [blank]email, device-form-title, [singleCase]password, register, [invalid]user.mobilePhone, [blank]user.fullName, [ExternalAuthenticationException], [blank]user.mobilePhone, [tooLong]password, [tooShort]user.password, [NotFoundException], email-verification-form, [tooShort]password, [moderationRejected]user.username, passwordConfirm, [invalid]applicationId, [MissingEmail], registration-verification-complete, [InvalidEmail], email-verification-complete, [doNotMatch]user.password, [notEqual]password, [EmailVerificationDisabled], two-factor-challenge, password-previous-constraint, [previouslyUsed]password, trust-computer, complete-registration, passwordless-button-text, [blank]user.parentEmail, registration-verification-sent-title, [MissingApplicationId], [TenantIdRequired], firstName, [blank]loginId, password-constraints-intro, logging-out, logout-title, [InvalidLogin], send, password-changed, [onlyAlpha]password, [PasswordChangedSinceLastLogin], next, [missing]user.birthDate, code, waiting, [UserLockedException], submit, [blank]user.username, [LoginPreventedException], password-changed-title, [Oauthv2Error], email-verification-sent, password-alpha-constraint, [InvalidChangePasswordId], [PasswordlessRequestSent], [tooYoung]password, [AdditionalFieldsRequired], [InvalidVerificationId], [invalid]code, parent-notified, [blank]parentEmail, forgot-your-password, [invalid]user_code, or, email-verification-complete-title, [blank]password, [MissingVerificationId], [duplicate]user.email, [MissingEmailAddressException], fullName, child-registration-not-allowed, birthDate, [onlyAlpha]user.password, [inactive]user.email, password-number-constraint, [requireNumber]password, device-title, registration-verification-complete-title, [blank]user.firstName, email-verification-form-title, middleName, [MissingChangePasswordId], [blank]code, [UserUnauthenticated], username"
        }
      ]
    }
  },
  "successResponse": null,
  "exception": null
}

Expected behavior

defaultMessages are optional and it's possible to clone the default theme.

@robotdan
Copy link
Member

This should work... is your source theme up to date and have all of the required keys?

It is possible if you upgraded that if you view the theme in the UI it will prompt you to add missing keys. This can happen if we add a new value to the default messages, then next time you edit the theme in the UI it will prompt you to add the missing keys.

Perhaps an enhancement we could make is that if the source theme is in this state and you use it as a source during a Theme create instead of failing we just fall back to the default values in the default theme so that this type of API call never fails even if the source theme needs attention.

@robotdan robotdan self-assigned this Jan 30, 2020
@trollr
Copy link
Author

trollr commented Jan 30, 2020

The source theme is the default theme. Would think this is in a clean state.

@robotdan
Copy link
Member

If the sourceThemeId is 75a068fd-e94b-451a-9aeb-3ddb9a3b5987 it will be a clean slate.

If you are using that as your source and you are getting validation errors that sounds like a bug.

If you are using a sourceThemeId of an existing theme you created previously it is possible that through upgrades it is missing some values as I described above.

@trollr
Copy link
Author

trollr commented Jan 31, 2020

I used 75a068fd-e94b-451a-9aeb-3ddb9a3b5987 as my source. So it seems to be a bug :(

@robotdan
Copy link
Member

robotdan commented Feb 5, 2020

I see the error now, I missed it when looking at your request JSON. The sourceThemeId is a top level value, next to the theme object.

https://fusionauth.io/docs/v1/tech/apis/themes

Try this:

{
  "sourceThemeId": "xxxxx",
  "theme": {
     "name": "Orange Theme"
  }
}

@robotdan
Copy link
Member

Let me know if this is still an issue or if my suggestion corrected the behavior you're seeing. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Further information is requested or user requires assistance working as designed
Projects
None yet
Development

No branches or pull requests

2 participants