diff --git a/src/main/java/org/codelibs/fess/app/web/profile/ProfileAction.java b/src/main/java/org/codelibs/fess/app/web/profile/ProfileAction.java new file mode 100644 index 000000000..026626692 --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/profile/ProfileAction.java @@ -0,0 +1,94 @@ +/* + * Copyright 2012-2016 CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +/** + * @author Keiichi Watanabe + */ +package org.codelibs.fess.app.web.profile; + +import javax.annotation.Resource; + +import org.codelibs.core.lang.StringUtil; +import org.codelibs.fess.app.web.base.FessSearchAction; +import org.codelibs.fess.app.web.base.login.FessLoginAssist; +import org.codelibs.fess.app.web.login.LoginAction; +import org.lastaflute.web.Execute; +import org.lastaflute.web.response.HtmlResponse; +import org.lastaflute.web.validation.VaErrorHook; + +public class ProfileAction extends FessSearchAction { + + // =================================================================================== + // Constant + // + + // =================================================================================== + // Attribute + // + @Resource + protected FessLoginAssist fessLoginAssist; + + // =================================================================================== + // Hook + // ====== + + // =================================================================================== + // Search Execute + // ============== + + @Execute + public HtmlResponse index() { + if (fessLoginAssist.getSessionUserBean().isPresent()) { + return asHtml(path_Profile_IndexJsp).useForm(ProfileForm.class); + } else { + return redirect(LoginAction.class); + } + } + + @Execute + public HtmlResponse changePassword(final ProfileForm form) { + validatePasswordForm(form, () -> index()); + // TODO + return redirect(getClass()); + } + + private void validatePasswordForm(final ProfileForm form, final VaErrorHook validationErrorLambda) { + validate(form, messages -> {}, () -> { + form.clearSecurityInfo(); + return index(); + }); + if (StringUtil.isBlank(form.oldPassword)) { + form.clearSecurityInfo(); + throwValidationError(messages -> { + messages.addErrorsBlankPassword("oldPassword"); + }, validationErrorLambda); + } + if (StringUtil.isBlank(form.newPassword)) { + form.newPassword = null; + form.confirmPassword = null; + throwValidationError(messages -> { + messages.addErrorsBlankPassword("newPassword"); + }, validationErrorLambda); + } + if (form.newPassword != null && !form.newPassword.equals(form.confirmPassword)) { + form.newPassword = null; + form.confirmPassword = null; + throwValidationError(messages -> { + messages.addErrorsInvalidConfirmPassword("confirmPassword"); + }, validationErrorLambda); + } + } +} diff --git a/src/main/java/org/codelibs/fess/app/web/profile/ProfileForm.java b/src/main/java/org/codelibs/fess/app/web/profile/ProfileForm.java new file mode 100644 index 000000000..88bf0472a --- /dev/null +++ b/src/main/java/org/codelibs/fess/app/web/profile/ProfileForm.java @@ -0,0 +1,44 @@ +/* + * Copyright 2012-2016 CodeLibs Project and the Others. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ + +/** + * @author Keiichi Watanabe + */ +package org.codelibs.fess.app.web.profile; + +import java.io.Serializable; + +import org.hibernate.validator.constraints.NotBlank; + +public class ProfileForm implements Serializable { + private static final long serialVersionUID = 1L; + + @NotBlank + public String oldPassword; + + @NotBlank + public String newPassword; + + @NotBlank + public String confirmPassword; + + public void clearSecurityInfo() { + oldPassword = null; + newPassword = null; + confirmPassword = null; + } + +} diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java index f3cd3d765..eb81ae99c 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessHtmlPath.java @@ -329,6 +329,15 @@ public interface FessHtmlPath { /** The path of the HTML: /login/logout.jsp */ HtmlNext path_Login_LogoutJsp = new HtmlNext("/login/logout.jsp"); + /** The path of the HTML: /profile/footer.jsp */ + HtmlNext path_Profile_FooterJsp = new HtmlNext("/profile/footer.jsp"); + + /** The path of the HTML: /profile/header.jsp */ + HtmlNext path_Profile_HeaderJsp = new HtmlNext("/profile/header.jsp"); + + /** The path of the HTML: /profile/index.jsp */ + HtmlNext path_Profile_IndexJsp = new HtmlNext("/profile/index.jsp"); + /** The path of the HTML: /search.jsp */ HtmlNext path_SearchJsp = new HtmlNext("/search.jsp"); diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java index 5472e5e69..32eb3d089 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java @@ -770,6 +770,27 @@ public class FessLabels extends ActionMessages { /** The key of the message: Logout */ public static final String LABELS_logout_button = "{labels.logout_button}"; + /** The key of the message: Profile */ + public static final String LABELS_PROFILE = "{labels.profile}"; + + /** The key of the message: Profile */ + public static final String LABELS_profile_button = "{labels.profile_button}"; + + /** The key of the message: Profile */ + public static final String LABELS_PROFILE_TITLE = "{labels.profile.title}"; + + /** The key of the message: Update */ + public static final String LABELS_PROFILE_UPDATE = "{labels.profile.update}"; + + /** The key of the message: Old Password */ + public static final String LABELS_PROFILE_placeholder_old_password = "{labels.profile.placeholder_old_password}"; + + /** The key of the message: New Password */ + public static final String LABELS_PROFILE_placeholder_new_password = "{labels.profile.placeholder_new_password}"; + + /** The key of the message: Confirm New Password */ + public static final String LABELS_PROFILE_placeholder_confirm_new_password = "{labels.profile.placeholder_confirm_new_password}"; + /** The key of the message: Search */ public static final String LABELS_TOP_SEARCH = "{labels.top.search}"; diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index 529b7cdad..c26d0a706 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -614,7 +614,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. guest */ String SUGGEST_ROLE_FILTERS = "suggest.role.filters"; - /** The key of the configuration. e.g. true */ + /** The key of the configuration. e.g. false */ String LDAP_ADMIN_ENABLED = "ldap.admin.enabled"; /** The key of the configuration. e.g. com.sun.jndi.ldap.LdapCtxFactory */ @@ -2495,7 +2495,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** * Get the value for the key 'ldap.admin.enabled'.
- * The value is, e.g. true
+ * The value is, e.g. false
* comment: ------ * @return The value of found property. (NotNull: if not found, exception but basically no way) */ @@ -2503,7 +2503,7 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** * Is the property for the key 'ldap.admin.enabled' true?
- * The value is, e.g. true
+ * The value is, e.g. false
* comment: ------ * @return The determination, true or false. (if not found, exception but basically no way) */ diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties index c50b750ed..fd563108e 100644 --- a/src/main/resources/fess_label.properties +++ b/src/main/resources/fess_label.properties @@ -251,6 +251,13 @@ labels.logout_title=Logout labels.logout=Logout labels.do_you_want_to_logout=Do you want to logout? labels.logout_button=Logout +labels.profile=Profile +labels.profile_button=Profile +labels.profile.title=Profile +labels.profile.update=Update +labels.profile.placeholder_old_password=Old Password +labels.profile.placeholder_new_password=New Password +labels.profile.placeholder_confirm_new_password=Confirm New Password labels.top.search=Search labels.index_title=Fess labels.index_form_search_btn=Search diff --git a/src/main/resources/fess_label_en.properties b/src/main/resources/fess_label_en.properties index c50b750ed..fd563108e 100644 --- a/src/main/resources/fess_label_en.properties +++ b/src/main/resources/fess_label_en.properties @@ -251,6 +251,13 @@ labels.logout_title=Logout labels.logout=Logout labels.do_you_want_to_logout=Do you want to logout? labels.logout_button=Logout +labels.profile=Profile +labels.profile_button=Profile +labels.profile.title=Profile +labels.profile.update=Update +labels.profile.placeholder_old_password=Old Password +labels.profile.placeholder_new_password=New Password +labels.profile.placeholder_confirm_new_password=Confirm New Password labels.top.search=Search labels.index_title=Fess labels.index_form_search_btn=Search diff --git a/src/main/resources/fess_label_ja.properties b/src/main/resources/fess_label_ja.properties index f0a4b5c98..765ad16de 100644 --- a/src/main/resources/fess_label_ja.properties +++ b/src/main/resources/fess_label_ja.properties @@ -245,6 +245,13 @@ labels.logout_title = \u30ed\u30b0\u30a2\u30a6\u30c8 labels.logout = \u30ed\u30b0\u30a2\u30a6\u30c8 labels.do_you_want_to_logout = \u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u307e\u3059\u304b\uff1f labels.logout_button = \u30ed\u30b0\u30a2\u30a6\u30c8 +labels.profile = \u8a2d\u5b9a +labels.profile_button = \u8a2d\u5b9a +labels.profile.title= \u8a2d\u5b9a +labels.profile.update= \u66f4\u65b0 +labels.profile.placeholder_old_password= \u53e4\u3044\u30d1\u30b9\u30ef\u30fc\u30c9 +labels.profile.placeholder_new_password= \u65b0\u3057\u3044\u30d1\u30b9\u30ef\u30fc\u30c9 +labels.profile.placeholder_confirm_new_password= \u65b0\u3057\u3044\u30d1\u30b9\u30ef\u30fc\u30c9\x28\u78ba\u8a8d\x29 labels.top.search = \u691c\u7d22 labels.index_title = Fess labels.index_form_search_btn = \u691c\u7d22 diff --git a/src/main/webapp/WEB-INF/view/header.jsp b/src/main/webapp/WEB-INF/view/header.jsp index a388a3fc0..bb0ceaa76 100755 --- a/src/main/webapp/WEB-INF/view/header.jsp +++ b/src/main/webapp/WEB-INF/view/header.jsp @@ -15,6 +15,9 @@ ${fe:facetForm()}${fe:geoForm()} ${username}