diff --git a/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_de.properties b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_de.properties new file mode 100644 index 0000000000..3321f1e212 --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_de.properties @@ -0,0 +1,4 @@ +enabled=de Enabled +name=de Name +save=de Save +cancel=de Cancel \ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_en.properties b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_en.properties new file mode 100644 index 0000000000..22f8708932 --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/common_en.properties @@ -0,0 +1,4 @@ +enabled=Enabled +name=Name +save=Save +cancel=Cancel \ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_de.properties b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_de.properties new file mode 100644 index 0000000000..4b79d17fbe --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_de.properties @@ -0,0 +1,18 @@ +realm-detail.enabled.tooltip=de Users and clients can only access a realm if it's enabled +realm-login-settings.registrationAllowed=de User registration +realm-login-settings.registrationAllowed.tooltip=de Enable/disable the registration page. A link for registration will show on login page too. +realm-login-settings.registrationEmailAsUsername=de Email as username +realm-login-settings.registrationEmailAsUsername.tooltip=de If enabled then username field is hidden from registration form and email is used as username for new user. +realm-login-settings.editUsernameAllowed=de Edit username +realm-login-settings.editUsernameAllowed.tooltip=de If enabled, the username field is editable, readonly otherwise. +realm-login-settings.resetPasswordAllowed=de Forget password +realm-login-settings.resetPasswordAllowed.tooltip=de Show a link on login page for user to click on when they have forgotten their credentials. +realm-login-settings.rememberMe=de Remember Me +realm-login-settings.rememberMe.tooltip=de Show checkbox on login page to allow user to remain logged in between browser restarts until session expires. +realm-login-settings.verifyEmail=de Verify email +realm-login-settings.verifyEmail.tooltip=de Require the user to verify their email address the first time they login. +realm-login-settings.sslRequired=de Require SSL +realm-login-settings.sslRequired.option.all=de all requests +realm-login-settings.sslRequired.option.external=de external requests +realm-login-settings.sslRequired.option.none=de none +realm-login-settings.sslRequired.tooltip=de Is HTTPS required? 'None' means HTTPS is not required for any client IP address. 'External requests' means localhost and private IP addresses can access without HTTPS. 'All requests' means HTTPS is required for all IP addresses. diff --git a/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_en.properties b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_en.properties new file mode 100644 index 0000000000..227c2f113d --- /dev/null +++ b/forms/common-themes/src/main/resources/theme/base/admin/angular-messages/realm-settings_en.properties @@ -0,0 +1,18 @@ +realm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled +registrationAllowed=User registration +registrationAllowed.tooltip=Enable/disable the registration page. A link for registration will show on login page too. +registrationEmailAsUsername=Email as username +registrationEmailAsUsername.tooltip=If enabled then username field is hidden from registration form and email is used as username for new user. +editUsernameAllowed=Edit username +editUsernameAllowed.tooltip=If enabled, the username field is editable, readonly otherwise. +resetPasswordAllowed=Forget password +resetPasswordAllowed.tooltip=Show a link on login page for user to click on when they have forgotten their credentials. +rememberMe=Remember Me +rememberMe.tooltip=Show checkbox on login page to allow user to remain logged in between browser restarts until session expires. +verifyEmail=Verify email +verifyEmail.tooltip=Require the user to verify their email address the first time they login. +sslRequired=Require SSL +sslRequired.option.all=all requests +sslRequired.option.external=external requests +sslRequired.option.none=none +sslRequired.tooltip=Is HTTPS required? 'None' means HTTPS is not required for any client IP address. 'External requests' means localhost and private IP addresses can access without HTTPS. 'All requests' means HTTPS is required for all IP addresses. diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html index 469e8c62d2..83f1288c09 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-detail.html @@ -3,29 +3,29 @@
- +
- +
- Users and clients can only access a realm if it's enabled + {{'realm-detail.enabled.tooltip' | translate}}
- - + +
- - + +
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-login-settings.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-login-settings.html index adccf3bee6..451a315f2f 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-login-settings.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-login-settings.html @@ -4,66 +4,66 @@
- +
- Enable/disable the registration page. A link for registration will show on login page too. + {{'registrationAllowed.tooltip' | translate}}
- +
- If enabled then username field is hidden from registration form and email is used as username for new user. + {{'registrationEmailAsUsername.tooltip' | translate}}
- +
- If enabled, the username field is editable, readonly otherwise. + {{'editUsernameAllowed.tooltip' | translate}}
- +
- Show a link on login page for user to click on when they have forgotten their credentials. + {{'resetPasswordAllowed.tooltip' |translate}}
- +
- Show checkbox on login page to allow user to remain logged in between browser restarts until session expires. + {{'rememberMe.tooltip' | translate}}
- +
- Require the user to verify their email address the first time they login. + {{'verifyEmail.tooltip' | translate}}
- +
- Is HTTPS required? 'None' means HTTPS is not required for any client IP address. 'External requests' means localhost and private IP addresses can access without HTTPS. 'All requests' means HTTPS is required for all IP addresses. + {{'sslRequired.tooltip' | translate}}
- - + +
diff --git a/services/src/main/java/org/keycloak/services/Urls.java b/services/src/main/java/org/keycloak/services/Urls.java index 16a08d6b74..33bdd57665 100755 --- a/services/src/main/java/org/keycloak/services/Urls.java +++ b/services/src/main/java/org/keycloak/services/Urls.java @@ -212,9 +212,9 @@ public class Urls { // I'm only using using localeCookiePath to get the /auth part of the path. // I can't assume the URL starts with "/auth". Keycloak could be installed // as root context. Typically, the angular-translate cookie path needs to be - // /auth/admin/{realmName}/console + // /auth/admin/{realmName}/console/ String basePath = localeCookiePath(baseUri, realmName); - return basePath.substring(0, basePath.indexOf("realms")) + "admin/" + realmName + "/console"; + return basePath.substring(0, basePath.indexOf("realms")) + "admin/" + realmName + "/console/"; } public static URI themeRoot(URI baseUri) { diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AdminMessagesLoader.java b/services/src/main/java/org/keycloak/services/resources/admin/AdminMessagesLoader.java index 96d4f8da9e..709cb12684 100644 --- a/services/src/main/java/org/keycloak/services/resources/admin/AdminMessagesLoader.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/AdminMessagesLoader.java @@ -17,8 +17,10 @@ package org.keycloak.services.resources.admin; +import java.io.File; +import java.io.FileInputStream; +import java.io.FilenameFilter; import java.io.IOException; -import java.io.InputStream; import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -33,6 +35,8 @@ import java.util.Properties; * @author Stan Silvert ssilvert@redhat.com (C) 2015 Red Hat Inc. */ public class AdminMessagesLoader { + private static final String CONFIG_DIR = System.getProperty("jboss.server.config.dir"); + private static final String BUNDLE_DIR = CONFIG_DIR + "/themes/base/admin/angular-messages/"; private static final Map allMessages = new HashMap(); @@ -44,19 +48,46 @@ public class AdminMessagesLoader { } private static Properties loadMessages(String locale) throws IOException { - Properties msgs = new Properties(); + Properties masterMsgs = new Properties(); - try (InputStream msgStream = getBundleStream(locale)){ - if (msgStream == null) return msgs; - msgs.load(msgStream); + for (File file : getBundlesForLocale(locale)) { + try (FileInputStream msgStream = new FileInputStream(file)){ + Properties propsFromFile = new Properties(); + propsFromFile.load(msgStream); + checkForDups(masterMsgs, propsFromFile, file, locale); + masterMsgs.putAll(propsFromFile); + } } - allMessages.put(locale, msgs); - return msgs; + allMessages.put(locale, masterMsgs); + return masterMsgs; } - private static InputStream getBundleStream(String locale) { - String filename = "admin-messages_" + locale + ".properties"; - return AdminMessagesLoader.class.getResourceAsStream(filename); + private static void checkForDups(Properties masterMsgs, Properties propsFromFile, File file, String locale) { + for (String prop : propsFromFile.stringPropertyNames()) { + if (masterMsgs.getProperty(prop) != null) { + String errorMsg = "Message bundle " + file.getName() + " contains key '" + prop; + errorMsg += "', which already exists in another bundle for " + locale + " locale."; + throw new RuntimeException(errorMsg); + } + } + } + + private static File[] getBundlesForLocale(String locale) { + File bundleDir = new File(BUNDLE_DIR); + return bundleDir.listFiles(new LocaleFilter(locale)); + } + + private static class LocaleFilter implements FilenameFilter { + private final String locale; + + public LocaleFilter(String locale) { + this.locale = locale; + } + + @Override + public boolean accept(File dir, String name) { + return name.endsWith("_" + locale + ".properties"); + } } } diff --git a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_de.properties b/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_de.properties deleted file mode 100644 index 792941f849..0000000000 --- a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_de.properties +++ /dev/null @@ -1,5 +0,0 @@ -enabled=Enabled -name=Name -save=Save -cancel=Cancel -realm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled diff --git a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_en.properties b/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_en.properties deleted file mode 100644 index 792941f849..0000000000 --- a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_en.properties +++ /dev/null @@ -1,5 +0,0 @@ -enabled=Enabled -name=Name -save=Save -cancel=Cancel -realm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled diff --git a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_it.properties b/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_it.properties deleted file mode 100644 index 792941f849..0000000000 --- a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_it.properties +++ /dev/null @@ -1,5 +0,0 @@ -enabled=Enabled -name=Name -save=Save -cancel=Cancel -realm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled diff --git a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_pt-BR.properties b/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_pt-BR.properties deleted file mode 100644 index 792941f849..0000000000 --- a/services/src/main/resources/org/keycloak/services/resources/admin/admin-messages_pt-BR.properties +++ /dev/null @@ -1,5 +0,0 @@ -enabled=Enabled -name=Name -save=Save -cancel=Cancel -realm-detail.enabled.tooltip=Users and clients can only access a realm if it's enabled