Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-27877

reset-pass: Email templates can be loaded except the default one

    Details

      Description

      Problem:
      In the ETS tool, we can see 4 templates related to reset-pass (account-validator). But only the default one is loaded.

      These templates are all translated in Chinese, which can be found in the template file. But these Chinese templates are not loaded.

      Why:
      In ValidationLogicImpl.java, the sentence below is invoked to check the existence of a template:
      emailTemplateService.getEmailTemplate(key, new Locale(locale)) == null

      The variable here is locale string (like es, zh_CN, etc.). But the wrong constructor of Locale is invoked. To a language_country locale, the constructor Locale(String language, String country) should be used.

      And after some effort to solve this problem, I find some other issues shows up. Even the Locale object is correct, the function getEmailTemplate of EmailTemplateService will not return null. Since the logic of it will find the 'default' template. And the correct method is getEmailTemplateNoDefault which is 'private'.

      So I just give up the effort and try to invoke the method processEmailTemplates in EmailTemplateService directly.

      The modification of EmailTemplateService is finished in SAK-27876, and this patch will make reset-pass to use it to load templates.

      Changes:
      1. Move all template files from account-validation-impl to account-validation-api to make EmailTemplateService to read them.

      2. Modify the code in ValidationLogicImpl.java to invoke ETS function and remove the tool-specified code. This almost remove 100 line of code.

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  maintenanceteam Core Team
                  Reporter:
                  gaojun Gao Jun
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration