From 1f92cf476fdb46e63827c873d4c1fa176f9355b2 Mon Sep 17 00:00:00 2001 From: koda Date: Sun, 12 Apr 2015 08:05:27 +0900 Subject: [PATCH] =?UTF-8?q?#2=20#25=20=E3=83=91=E3=82=B9=E3=83=AF=E3=83=BC?= =?UTF-8?q?=E3=83=89=E5=BF=98=E3=82=8C=E6=99=82=E3=81=AB=E3=80=81=E3=83=91?= =?UTF-8?q?=E3=82=B9=E3=83=AF=E3=83=BC=E3=83=89=E5=88=9D=E6=9C=9F=E5=8C=96?= =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=83=AB=E3=82=92=E5=87=BA=E3=81=99=20?= =?UTF-8?q?=E3=83=A1=E3=83=BC=E3=83=AB=E3=82=A2=E3=83=89=E3=83=AC=E3=82=B9?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=99=E3=82=8B=E9=9A=9B=E3=81=AB?= =?UTF-8?q?=E3=82=82=E3=80=81=E7=A2=BA=E8=AA=8D=E3=83=A1=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E3=82=92=E5=87=BA=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/knowledge/control/Control.java | 8 +- .../control/open/KnowledgeControl.java | 9 -- .../knowledge/control/open/LangControl.java | 40 +++++ .../open/PasswordInitializationControl.java | 140 ++++++++++++++++++ .../control/protect/AccountControl.java | 122 ++++++++++++++- .../project/knowledge/logic/AccountLogic.java | 127 +++++++++++++++- .../project/knowledge/logic/MailLogic.java | 131 +++++++++++++--- .../logic/PasswordInitializationLogic.java | 89 +++++++++++ .../knowledge/websocket/NotifyAction.java | 6 +- src/main/resources/appresource.properties | 18 ++- src/main/resources/appresource_ja.properties | 20 ++- .../project/knowledge/mail/mail_confirm.xml | 22 +++ .../knowledge/mail/mail_confirm_ja.xml | 22 +++ .../project/knowledge/mail/password_reset.xml | 23 +++ .../knowledge/mail/password_reset_ja.xml | 23 +++ .../WEB-INF/views/admin/config/system.jsp | 2 +- src/main/webapp/WEB-INF/views/auth/form.jsp | 7 +- .../views/commons/layout/commonNavbar.jsp | 4 +- .../forgot_pass_request.jsp | 52 +++++++ .../forgot_pass_result.jsp | 25 ++++ .../passwordinitialization/password_reset.jsp | 61 ++++++++ .../passwordinitialization/reset_result.jsp | 34 +++++ .../views/protect/account/changekey.jsp | 44 ++++++ .../views/protect/account/complete.jsp | 33 +++++ .../WEB-INF/views/protect/account/index.jsp | 8 +- .../views/protect/account/saveresult.jsp | 33 +++++ src/main/webapp/WEB-INF/web.xml | 4 +- 27 files changed, 1060 insertions(+), 47 deletions(-) create mode 100644 src/main/java/org/support/project/knowledge/control/open/PasswordInitializationControl.java create mode 100644 src/main/java/org/support/project/knowledge/logic/PasswordInitializationLogic.java create mode 100644 src/main/resources/org/support/project/knowledge/mail/mail_confirm.xml create mode 100644 src/main/resources/org/support/project/knowledge/mail/mail_confirm_ja.xml create mode 100644 src/main/resources/org/support/project/knowledge/mail/password_reset.xml create mode 100644 src/main/resources/org/support/project/knowledge/mail/password_reset_ja.xml create mode 100644 src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_request.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_result.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/passwordinitialization/password_reset.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/passwordinitialization/reset_result.jsp create mode 100644 src/main/webapp/WEB-INF/views/protect/account/changekey.jsp create mode 100644 src/main/webapp/WEB-INF/views/protect/account/complete.jsp create mode 100644 src/main/webapp/WEB-INF/views/protect/account/saveresult.jsp diff --git a/src/main/java/org/support/project/knowledge/control/Control.java b/src/main/java/org/support/project/knowledge/control/Control.java index bb9715453..1a368e256 100644 --- a/src/main/java/org/support/project/knowledge/control/Control.java +++ b/src/main/java/org/support/project/knowledge/control/Control.java @@ -60,6 +60,10 @@ protected String getResource(String key) { Resources resources = Resources.getInstance(HttpUtil.getLocale(getRequest())); return resources.getResource(key); } + protected String getResource(String key, String... params) { + Resources resources = Resources.getInstance(HttpUtil.getLocale(getRequest())); + return resources.getResource(key, params); + } protected void addMsgInfo(String key, String... params) { Resources resources = Resources.getInstance(HttpUtil.getLocale(getRequest())); @@ -85,9 +89,9 @@ protected void addMsgError(String key, String... params) { errors.add(HtmlUtils.escapeHTML(msg)); } - protected void setResult(String successMsg, List errors) { + protected void setResult(String successMsg, List errors, String... params) { if (errors == null || errors.isEmpty()) { - addMsgSuccess(successMsg); + addMsgSuccess(successMsg, params); } else { for (ValidateError validateError : errors) { if (validateError.getLevel().intValue() == LogLevel.ERROR.getValue()) { diff --git a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java index 18643dc32..4cbc984e9 100644 --- a/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java +++ b/src/main/java/org/support/project/knowledge/control/open/KnowledgeControl.java @@ -151,16 +151,7 @@ public Boundary list() throws Exception { String keyword = getParam("keyword"); String tag = getParam("tag"); String user = getParam("user"); - - if (StringUtils.isNotEmpty(keyword)) { - NotifyAction notify = Container.getComp(NotifyAction.class); - MessageResult message = new MessageResult(); - message.setMessage("検索されたよ: " + keyword); - notify.notifyObservers(message); - } - List knowledges = new ArrayList<>(); - if (StringUtils.isInteger(tag)) { //タグを選択している LOG.trace("show on Tag"); diff --git a/src/main/java/org/support/project/knowledge/control/open/LangControl.java b/src/main/java/org/support/project/knowledge/control/open/LangControl.java index 9bc06d0d6..efcce76cb 100644 --- a/src/main/java/org/support/project/knowledge/control/open/LangControl.java +++ b/src/main/java/org/support/project/knowledge/control/open/LangControl.java @@ -2,15 +2,20 @@ import java.util.Locale; +import org.apache.taglibs.standard.tag.common.fmt.SetLocaleSupport; +import org.support.project.common.util.StringUtils; import org.support.project.knowledge.control.Control; +import org.support.project.web.bean.LoginedUser; import org.support.project.web.boundary.Boundary; import org.support.project.web.common.HttpUtil; +import org.support.project.web.exception.InvalidParamException; public class LangControl extends Control { public Boundary en() { Locale locale = Locale.ENGLISH; HttpUtil.setLocale(super.getRequest(), locale); + this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); return redirect(getRequest().getContextPath() + "/index"); } @@ -18,7 +23,42 @@ public Boundary en() { public Boundary ja() { Locale locale = Locale.JAPANESE; HttpUtil.setLocale(super.getRequest(), locale); + this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); return redirect(getRequest().getContextPath() + "/index"); } + private void setLocale(LoginedUser loginedUser, Locale locale) { + if (loginedUser == null) { + return; + } + loginedUser.setLocale(locale); + } + + + public Boundary select() throws InvalidParamException { + String LocaleID = getPathString(); + if (StringUtils.isEmpty(LocaleID)) { + return en(); + } else if (LocaleID.equals("en")) { + return en(); + } else if (LocaleID.equals("ja")) { + return ja(); + } + Locale locale = Locale.ENGLISH; + if (LocaleID.indexOf("_") == -1) { + locale = new Locale(LocaleID); + } else { + String[] sp = LocaleID.split("_"); + if (sp.length == 2) { + locale = new Locale(sp[0], sp[1]); + } else if (sp.length >= 3) { + locale = new Locale(sp[0], sp[1], sp[2]); + } + } + HttpUtil.setLocale(super.getRequest(), locale); + this.setLocale(getLoginedUser(), HttpUtil.getLocale(getRequest())); + return redirect(getRequest().getContextPath() + "/index"); + } + + } diff --git a/src/main/java/org/support/project/knowledge/control/open/PasswordInitializationControl.java b/src/main/java/org/support/project/knowledge/control/open/PasswordInitializationControl.java new file mode 100644 index 000000000..3b60a01fc --- /dev/null +++ b/src/main/java/org/support/project/knowledge/control/open/PasswordInitializationControl.java @@ -0,0 +1,140 @@ +package org.support.project.knowledge.control.open; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.support.project.common.bean.ValidateError; +import org.support.project.common.util.StringUtils; +import org.support.project.common.validate.Validator; +import org.support.project.common.validate.ValidatorFactory; +import org.support.project.knowledge.control.Control; +import org.support.project.knowledge.logic.PasswordInitializationLogic; +import org.support.project.web.boundary.Boundary; +import org.support.project.web.common.HttpStatus; +import org.support.project.web.common.HttpUtil; +import org.support.project.web.dao.PasswordResetsDao; +import org.support.project.web.entity.PasswordResetsEntity; +import org.support.project.web.exception.InvalidParamException; + +public class PasswordInitializationControl extends Control { + + /** + * パスワード忘れの画面を表示 + * @return + */ + public Boundary view() { + return forward("forgot_pass_request.jsp"); + } + + /** + * パスワード初期化のリクエストの受付 + * @return + */ + public Boundary request() { + String email = getParam("username"); + + //入力チェック + List errors = new ArrayList(); + Validator validator = ValidatorFactory.getInstance(Validator.REQUIRED); + ValidateError validateError = validator.validate(email, "Email address"); + if (validateError != null) { + errors.add(validateError); + } + + validator = ValidatorFactory.getInstance(Validator.MAIL); + validateError = validator.validate(email, "Email address"); + if (validateError != null) { + errors.add(validateError); + } + if (!errors.isEmpty()) { + setResult("message.success.insert", errors); + return forward("forgot_pass_request.jsp"); + } + + // 初期化パスワードデータを発行 + validateError = PasswordInitializationLogic.get().insertPasswordReset(email, HttpUtil.getLocale(getRequest())); + if (validateError != null) { + errors.add(validateError); + } + + // 画面表示 + setResult("message.success.insert", errors); + if (!errors.isEmpty()) { + return forward("forgot_pass_request.jsp"); + } + + return forward("forgot_pass_result.jsp"); + } + + + /** + * パスワード初期化画面を表示 + * @return + * @throws InvalidParamException + */ + public Boundary init() throws InvalidParamException { + String key = getPathString(); + PasswordResetsDao resetsDao = PasswordResetsDao.get(); + PasswordResetsEntity resetsEntity = resetsDao.selectOnKey(key); + if (resetsEntity == null) { + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + + long now = new Date().getTime(); + if (now - resetsEntity.getInsertDatetime().getTime() > 1000 * 60 * 60) { + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + setAttribute("key", key); + setAttribute("reset", resetsEntity); + return forward("password_reset.jsp"); + } + + + /** + * パスワードの初期化 + * @return + */ + public Boundary change() { + String key = getParam("key"); + PasswordResetsDao resetsDao = PasswordResetsDao.get(); + PasswordResetsEntity resetsEntity = resetsDao.selectOnKey(key); + if (resetsEntity == null) { + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + long now = new Date().getTime(); + if (now - resetsEntity.getInsertDatetime().getTime() > 1000 * 60 * 60) { + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + setAttribute("key", key); + setAttribute("reset", resetsEntity); + + List errors = new ArrayList<>(); + if (!StringUtils.isEmpty(getParam("password"))) { + if (!getParam("password").equals(getParam("confirm_password", String.class))) { + ValidateError error = new ValidateError("knowledge.user.invalid.same.password"); + errors.add(error); + } + } else { + ValidateError error = new ValidateError("errors.required", "Password"); + errors.add(error); + } + if (!errors.isEmpty()) { + return forward("password_reset.jsp"); + } + + // パスワードデータを初期化 + ValidateError validateError = PasswordInitializationLogic.get().changePassword(resetsEntity, getParam("password")); + if (validateError != null) { + errors.add(validateError); + } + + // 画面表示 + setResult(getResource("message.success.update.target", "Password"), errors); + if (!errors.isEmpty()) { + return forward("password_reset.jsp"); + } + return forward("reset_result.jsp"); + } + +} diff --git a/src/main/java/org/support/project/knowledge/control/protect/AccountControl.java b/src/main/java/org/support/project/knowledge/control/protect/AccountControl.java index c47f4f584..b0048fb26 100644 --- a/src/main/java/org/support/project/knowledge/control/protect/AccountControl.java +++ b/src/main/java/org/support/project/knowledge/control/protect/AccountControl.java @@ -13,6 +13,8 @@ import org.support.project.di.Container; import org.support.project.di.DI; import org.support.project.di.Instance; +import org.support.project.knowledge.config.AppConfig; +import org.support.project.knowledge.config.SystemConfig; import org.support.project.knowledge.control.Control; import org.support.project.knowledge.logic.AccountLogic; import org.support.project.knowledge.logic.UserLogic; @@ -23,16 +25,30 @@ import org.support.project.web.boundary.Boundary; import org.support.project.web.common.HttpStatus; import org.support.project.web.common.HttpUtil; +import org.support.project.web.dao.SystemConfigsDao; import org.support.project.web.dao.UsersDao; +import org.support.project.web.entity.SystemConfigsEntity; import org.support.project.web.entity.UsersEntity; +import org.support.project.web.exception.InvalidParamException; import org.support.project.web.logic.AuthenticationLogic; import org.support.project.web.logic.impl.DefaultAuthenticationLogicImpl; @DI(instance=Instance.Prototype) public class AccountControl extends Control { - + + /** + * アカウント情報表示 + */ @Override public Boundary index() { + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = dao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN); + } + setAttribute("userAddType", userAddType.getConfigValue()); + LoginedUser loginedUser = super.getLoginedUser(); if (loginedUser == null) { sendError(HttpStatus.SC_401_UNAUTHORIZED, ""); @@ -45,7 +61,20 @@ public Boundary index() { return forward("index.jsp"); } + /** + * ユーザの情報更新 + * @return + */ public Boundary update() { + SystemConfigsDao systemConfigsDao = SystemConfigsDao.get(); + + SystemConfigsEntity userAddType = systemConfigsDao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN); + } + setAttribute("userAddType", userAddType.getConfigValue()); + LoginedUser loginedUser = super.getLoginedUser(); if (loginedUser == null) { sendError(HttpStatus.SC_401_UNAUTHORIZED, ""); @@ -75,7 +104,15 @@ public Boundary update() { if (user == null) { sendError(HttpStatus.SC_400_BAD_REQUEST, "user is allready removed."); } - user.setUserKey(getParam("userKey")); + if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN)) { + //ユーザ登録を管理者が行っている場合、メールアドレスは変更出来ない(変更用の画面も使えない) + } else if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_APPROVE)) { + // ユーザが自分で登録して管理者が承認の場合も変更出来ない(変更用の画面も使えない) + } else if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) { + // ダブルオプトインの場合も変更出来ない(変更用の画面で変更) + } else { + user.setUserKey(getParam("userKey")); + } user.setUserName(getParam("userName")); if (!StringUtils.isEmpty(getParam("password"))) { user.setPassword(getParam("password")); @@ -171,4 +208,85 @@ private ValidateError checkFile(FileItem fileItem) { Validator validator = ValidatorFactory.getInstance(Validator.EXTENSION); return validator.validate(name, "icon", "png", "jpg", "jpeg", "gif"); } + + /** + * メールアドレスの変更リクエストを登録する画面を表示 + * @return + */ + public Boundary changekey() { + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = dao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN); + } + if (!userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) { + return sendError(HttpStatus.SC_403_FORBIDDEN, "FORBIDDEN"); + } + //ダブルオプトインでユーザ登録をしている場合のみ、メールアドレス変更通知にてアドレスを変更する + + return forward("changekey.jsp"); + } + + + /** + * メールアドレスの変更リクエストを登録 + * @return + */ + public Boundary changerequest() { + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = dao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN); + } + if (!userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) { + return sendError(HttpStatus.SC_403_FORBIDDEN, "FORBIDDEN"); + } + + //ダブルオプトインでユーザ登録をしている場合のみ、メールアドレス変更通知にてアドレスを変更する + AccountLogic accountLogic = AccountLogic.get(); + List results = accountLogic.saveChangeEmailRequest(getParam("userKey"), getLoginedUser()); + + setResult("message.success.insert.target", results, getResource("knowledge.account.changekey.title")); + + if (results != null && !results.isEmpty()) { + return forward("changekey.jsp"); + } + return forward("saveresult.jsp"); + } + + /** + * メールアドレス変更通知の確認 + * @return + * @throws InvalidParamException + */ + public Boundary confirm_mail() throws InvalidParamException { + // メールアドレス変更ができるのは、ダブルオプトインでユーザ登録する設定になっている場合のみ + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = dao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN); + } + if (!userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) { + return sendError(HttpStatus.SC_403_FORBIDDEN, "FORBIDDEN"); + } + + String id = getPathString(); + if (StringUtils.isEmpty(id)) { + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + + AccountLogic accountLogic = AccountLogic.get(); + List results = accountLogic.completeChangeEmailRequest(id, getLoginedUser()); + setResult("knowledge.account.changekey.complete", results); + if (results != null && !results.isEmpty()) { + return index(); //何かエラーになった場合アカウントの画面へ遷移 + } + //return forward("complete.jsp"); + return index(); //エラーの無い場合でもアカウントの画面へ遷移(新しいメールアドレスになったことを確認) + } + + } diff --git a/src/main/java/org/support/project/knowledge/logic/AccountLogic.java b/src/main/java/org/support/project/knowledge/logic/AccountLogic.java index 2eae04722..e7cd45dde 100644 --- a/src/main/java/org/support/project/knowledge/logic/AccountLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/AccountLogic.java @@ -1,17 +1,30 @@ package org.support.project.knowledge.logic; import java.io.IOException; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.UUID; import org.apache.commons.fileupload.FileItem; +import org.support.project.aop.Aspect; +import org.support.project.common.bean.ValidateError; import org.support.project.common.log.Log; import org.support.project.common.log.LogFactory; +import org.support.project.common.util.DateUtils; +import org.support.project.common.util.RandomUtil; import org.support.project.common.util.StringUtils; +import org.support.project.common.validate.Validator; +import org.support.project.common.validate.ValidatorFactory; import org.support.project.di.Container; import org.support.project.knowledge.dao.AccountImagesDao; import org.support.project.knowledge.entity.AccountImagesEntity; import org.support.project.knowledge.vo.UploadFile; import org.support.project.web.bean.LoginedUser; +import org.support.project.web.dao.ConfirmMailChangesDao; +import org.support.project.web.dao.UsersDao; +import org.support.project.web.entity.ConfirmMailChangesEntity; +import org.support.project.web.entity.UsersEntity; public class AccountLogic { /** ログ */ @@ -20,7 +33,16 @@ public class AccountLogic { public static AccountLogic get() { return Container.getComp(AccountLogic.class); } - + + /** + * アイコンの保存 + * @param fileItem + * @param loginedUser + * @param context + * @return + * @throws IOException + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) public UploadFile saveIconImage(FileItem fileItem, LoginedUser loginedUser, String context) throws IOException { LOG.trace("saveFile()"); AccountImagesDao dao = AccountImagesDao.get(); @@ -64,6 +86,7 @@ public UploadFile saveIconImage(FileItem fileItem, LoginedUser loginedUser, Stri * @param entity * @return */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) private UploadFile convUploadFile(String context, AccountImagesEntity entity) { UploadFile file = new UploadFile(); file.setFileNo(new Long(entity.getUserId())); @@ -77,5 +100,107 @@ private UploadFile convUploadFile(String context, AccountImagesEntity entity) { return file; } + /** + * Emailの変更のリクエストを受け付ける + * @param changeEmail + * @param loginedUser + * @return + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public List saveChangeEmailRequest(String changeEmail, LoginedUser loginedUser) { + List errors = new ArrayList(); + Validator validator = ValidatorFactory.getInstance(Validator.REQUIRED); + ValidateError error = validator.validate(changeEmail, "E-Mail"); + if (error != null) { + errors.add(error); + } + validator = ValidatorFactory.getInstance(Validator.MAIL); + error = validator.validate(changeEmail, "E-Mail"); + if (error != null) { + errors.add(error); + } + UsersDao usersDao = UsersDao.get(); + UsersEntity usersEntity = usersDao.selectOnUserKey(changeEmail); + if (usersEntity != null) { + error = new ValidateError("errors.exist", "E-Mail"); + errors.add(error); + } + if (!errors.isEmpty()) { + return errors; + } + + // 変更のリクエストデータを保存 + ConfirmMailChangesDao mailChangesDao = ConfirmMailChangesDao.get(); + ConfirmMailChangesEntity mailChangesEntity = new ConfirmMailChangesEntity(); + mailChangesEntity.setId(idGen(loginedUser.getUserId().toString())); + mailChangesEntity.setMailAddress(changeEmail); + mailChangesEntity.setUserId(loginedUser.getUserId()); + mailChangesDao.insert(mailChangesEntity); + + //メール送信 + MailLogic.get().sendChangeEmailRequest(mailChangesEntity, loginedUser); + return errors; + } + /** + * メール送信のIDを生成 + * @param string + * @return + */ + private String idGen(String label) { + StringBuilder builder = new StringBuilder(); + builder.append(label); + builder.append("-"); + builder.append(DateUtils.TRANSFER_DATETIME.format(new Date())); + builder.append("-"); + builder.append(UUID.randomUUID().toString()); + builder.append("-"); + builder.append(RandomUtil.randamGen(32)); + return builder.toString(); + } + + + /** + * メールアドレス変更処理を完了 + * @param id + * @param loginedUser + * @return + */ + public List completeChangeEmailRequest(String id, LoginedUser loginedUser) { + List errors = new ArrayList(); + ConfirmMailChangesDao mailChangesDao = ConfirmMailChangesDao.get(); + ConfirmMailChangesEntity mailChangesEntity = mailChangesDao.selectOnKey(id); + + if (mailChangesEntity == null) { + ValidateError error = new ValidateError("errors.invalid", "path"); + errors.add(error); + } + if (mailChangesEntity.getUserId().intValue() != loginedUser.getUserId().intValue()) { + ValidateError error = new ValidateError("errors.invalid", "path"); + errors.add(error); + } + + UsersDao usersDao = UsersDao.get(); + UsersEntity usersEntity = usersDao.selectOnUserKey(mailChangesEntity.getMailAddress()); + if (usersEntity != null) { + ValidateError error = new ValidateError("errors.exist", "E-Mail"); + errors.add(error); + } + if (!errors.isEmpty()) { + return errors; + } + + usersEntity = usersDao.selectOnKey(loginedUser.getUserId()); + if (usersEntity == null) { + ValidateError error = new ValidateError("errors.invalid", "path"); + errors.add(error); + } else { + usersEntity.setUserKey(mailChangesEntity.getMailAddress()); + usersDao.update(usersEntity); + } + // メール変更を無効化 + mailChangesDao.delete(mailChangesEntity); + return errors; + } + } diff --git a/src/main/java/org/support/project/knowledge/logic/MailLogic.java b/src/main/java/org/support/project/knowledge/logic/MailLogic.java index f706671ca..bd428b132 100644 --- a/src/main/java/org/support/project/knowledge/logic/MailLogic.java +++ b/src/main/java/org/support/project/knowledge/logic/MailLogic.java @@ -1,7 +1,5 @@ package org.support.project.knowledge.logic; -import java.text.DateFormat; -import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Locale; @@ -11,15 +9,20 @@ import org.support.project.common.config.LocaleConfigLoader; import org.support.project.common.log.Log; import org.support.project.common.log.LogFactory; +import org.support.project.common.util.DateUtils; +import org.support.project.common.util.StringUtils; import org.support.project.di.Container; import org.support.project.knowledge.bat.MailSendBat; import org.support.project.knowledge.config.AppConfig; import org.support.project.knowledge.config.MailConfig; import org.support.project.knowledge.config.SystemConfig; +import org.support.project.web.bean.LoginedUser; import org.support.project.web.dao.MailsDao; import org.support.project.web.dao.SystemConfigsDao; import org.support.project.web.dao.UsersDao; +import org.support.project.web.entity.ConfirmMailChangesEntity; import org.support.project.web.entity.MailsEntity; +import org.support.project.web.entity.PasswordResetsEntity; import org.support.project.web.entity.ProvisionalRegistrationsEntity; import org.support.project.web.entity.SystemConfigsEntity; import org.support.project.web.entity.UsersEntity; @@ -28,12 +31,29 @@ public class MailLogic { /** ログ */ private static Log LOG = LogFactory.getLog(MailLogic.class); - private DateFormat DAY_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); + //private static final DateFormat DAY_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); + private static final String MAIL_CONFIG_DIR = "/org/support/project/knowledge/mail/"; + public static MailLogic get() { return Container.getComp(MailLogic.class); } + /** + * メール送信のIDを生成 + * @param label 11桁まで + * @return + */ + public String idGen(String label) { + StringBuilder builder = new StringBuilder(); + builder.append(label); + builder.append("-"); + builder.append(DateUtils.SECOND_FORMAT.format(new Date())); + builder.append("-"); + builder.append(UUID.randomUUID().toString()); + return builder.toString(); + } + /** * メール設定の読み込み * @param configName @@ -46,6 +66,34 @@ public MailConfig load(String configName, Locale locale) { return mailConfig; } + + /** + * URLを生成 + * @param id + * @return + */ + private CharSequence makeURL(String servletPath, String id) { + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity config = dao.selectOnKey(SystemConfig.SYSTEM_URL, AppConfig.SYSTEM_NAME); + if (config == null) { + return ""; + } + + StringBuilder builder = new StringBuilder(); + builder.append(config.getConfigValue()); + if (!config.getConfigValue().endsWith("/")) { + builder.append("/"); + } + builder.append(servletPath); + if (!StringUtils.isEmpty(id)) { + if (!servletPath.endsWith("/")) { + builder.append("/"); + } + builder.append(id); + } + return builder.toString(); + } + /** * ユーザが仮登録されたので、そのユーザに招待のメールを送信するために、 * メール送信テーブルに登録する @@ -57,7 +105,7 @@ public void sendInvitation(ProvisionalRegistrationsEntity entity, String url, Lo LOG.trace("sendInvitation"); MailsDao mailsDao = MailsDao.get(); MailsEntity mailsEntity = new MailsEntity(); - String mailId = idGenu("Invitation"); + String mailId = idGen("Invitation"); mailsEntity.setMailId(mailId); mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); mailsEntity.setToAddress(entity.getUserKey()); @@ -88,7 +136,7 @@ public void sendAcceptedAddRequest(ProvisionalRegistrationsEntity entity, String LOG.trace("sendAcceptedAddRequest"); MailsDao mailsDao = MailsDao.get(); MailsEntity mailsEntity = new MailsEntity(); - String mailId = idGenu("Accept"); + String mailId = idGen("Accept"); mailsEntity.setMailId(mailId); mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); mailsEntity.setToAddress(entity.getUserKey()); @@ -110,20 +158,7 @@ public void sendAcceptedAddRequest(ProvisionalRegistrationsEntity entity, String } - /** - * メール送信のIDを生成 - * @param string - * @return - */ - private String idGenu(String label) { - StringBuilder builder = new StringBuilder(); - builder.append(label); - builder.append("-"); - builder.append(DAY_FORMAT.format(new Date())); - builder.append("-"); - builder.append(UUID.randomUUID().toString()); - return builder.toString(); - } + /** @@ -148,7 +183,7 @@ public void sendNotifyAddUser(UsersEntity user) { MailsDao mailsDao = MailsDao.get(); MailsEntity mailsEntity = new MailsEntity(); - String mailId = idGenu("Notify"); + String mailId = idGen("Notify"); mailsEntity.setMailId(mailId); mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); mailsEntity.setToAddress(entity.getUserKey()); @@ -182,7 +217,7 @@ public void sendNotifyAcceptUser(ProvisionalRegistrationsEntity registrationsEnt MailsDao mailsDao = MailsDao.get(); MailsEntity mailsEntity = new MailsEntity(); - String mailId = idGenu("Notify"); + String mailId = idGen("Notify"); mailsEntity.setMailId(mailId); mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); mailsEntity.setToAddress(entity.getUserKey()); @@ -195,8 +230,60 @@ public void sendNotifyAcceptUser(ProvisionalRegistrationsEntity registrationsEnt } + /** + * メール変更のリクエストを受付 + * @param email + * @param locale + * @param resetsEntity + */ + public void sendPasswordReset(String email, Locale locale, PasswordResetsEntity resetsEntity) { + MailsEntity mailsEntity = new MailsEntity(); + String mailId = idGen("MAIL-RESET"); + mailsEntity.setMailId(mailId); + mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); + mailsEntity.setToAddress(email); + mailsEntity.setToName(email); + + MailConfig config = LocaleConfigLoader.load(MAIL_CONFIG_DIR, "password_reset", locale, MailConfig.class);; + + String title = config.getTitle(); + mailsEntity.setTitle(title); + String contents = config.getContents(); + contents = contents.replace("{MAIL}", email); + contents = contents.replace("{URL}", makeURL("open.PasswordInitialization/init/", resetsEntity.getId())); + + mailsEntity.setContent(contents); + MailsDao.get().insert(mailsEntity); + } + - + /** + * メールアドレス変更確認 + * @param mailChangesEntity + * @param loginedUser + */ + public void sendChangeEmailRequest(ConfirmMailChangesEntity mailChangesEntity, LoginedUser loginedUser) { + MailsEntity mailsEntity = new MailsEntity(); + String mailId = idGen("MAIL-CHANGE"); + mailsEntity.setMailId(mailId); + mailsEntity.setStatus(MailSendBat.MAIL_STATUS_UNSENT); + mailsEntity.setToAddress(mailChangesEntity.getMailAddress()); + mailsEntity.setToName(loginedUser.getLoginUser().getUserName()); + + MailConfig config = LocaleConfigLoader.load(MAIL_CONFIG_DIR, "mail_confirm", loginedUser.getLocale(), MailConfig.class);; + + String title = config.getTitle(); + mailsEntity.setTitle(title); + String contents = config.getContents(); + contents = contents.replace("{UserName}", loginedUser.getLoginUser().getUserName()); + contents = contents.replace("{URL}", makeURL("protect.Account/confirm_mail/", mailChangesEntity.getId())); + + mailsEntity.setContent(contents); + MailsDao.get().insert(mailsEntity); + } + + + } diff --git a/src/main/java/org/support/project/knowledge/logic/PasswordInitializationLogic.java b/src/main/java/org/support/project/knowledge/logic/PasswordInitializationLogic.java new file mode 100644 index 000000000..31b4d444a --- /dev/null +++ b/src/main/java/org/support/project/knowledge/logic/PasswordInitializationLogic.java @@ -0,0 +1,89 @@ +package org.support.project.knowledge.logic; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; +import java.util.UUID; + +import org.support.project.aop.Aspect; +import org.support.project.common.bean.ValidateError; +import org.support.project.common.config.LocaleConfigLoader; +import org.support.project.common.log.Log; +import org.support.project.common.log.LogFactory; +import org.support.project.common.util.RandomUtil; +import org.support.project.di.Container; +import org.support.project.knowledge.bat.MailSendBat; +import org.support.project.knowledge.config.AppConfig; +import org.support.project.knowledge.config.MailConfig; +import org.support.project.knowledge.config.SystemConfig; +import org.support.project.web.dao.MailsDao; +import org.support.project.web.dao.PasswordResetsDao; +import org.support.project.web.dao.SystemConfigsDao; +import org.support.project.web.dao.UsersDao; +import org.support.project.web.entity.MailsEntity; +import org.support.project.web.entity.PasswordResetsEntity; +import org.support.project.web.entity.SystemConfigsEntity; +import org.support.project.web.entity.UsersEntity; + +public class PasswordInitializationLogic { + /** ログ */ + private static Log LOG = LogFactory.getLog(PasswordInitializationLogic.class); + + public static PasswordInitializationLogic get() { + return Container.getComp(PasswordInitializationLogic.class); + } + + + /** + * パスワードリセットメールの送信 + * @param email + * @return + */ + public ValidateError insertPasswordReset(String email, Locale locale) { + // 存在チェック + UsersDao usersDao = UsersDao.get(); + if (usersDao.selectOnUserKey(email) == null) { + return new ValidateError("errors.noexist", "Email Address"); + } + + // 初期化データ登録 + PasswordResetsEntity resetsEntity = new PasswordResetsEntity(); + resetsEntity.setId(MailLogic.get().idGen("RESET-").concat("-").concat(RandomUtil.randamGen(32))); + resetsEntity.setUserKey(email); + PasswordResetsDao resetsDao = PasswordResetsDao.get(); + resetsDao.insert(resetsEntity); + + // メール送信 + MailLogic.get().sendPasswordReset(email, locale, resetsEntity); + + return null; + } + + + /** + * パスワード初期化 + * @param resetsEntity + * @param password + * @return + */ + @Aspect(advice=org.support.project.ormapping.transaction.Transaction.class) + public ValidateError changePassword(PasswordResetsEntity resetsEntity, String password) { + // パスワード更新 + UsersDao usersDao = UsersDao.get(); + UsersEntity entity = usersDao.selectOnUserKey(resetsEntity.getUserKey()); + if (entity == null) { + return new ValidateError("errors.noexist", "Email Address"); + } + entity.setUpdateUser(entity.getUserId()); + entity.setPassword(password); + usersDao.update(entity); + + // パスワード初期化リクエストを無効にする + PasswordResetsDao.get().delete(resetsEntity); + + return null; + } + + +} diff --git a/src/main/java/org/support/project/knowledge/websocket/NotifyAction.java b/src/main/java/org/support/project/knowledge/websocket/NotifyAction.java index ebf33060f..ce7dfdbe3 100644 --- a/src/main/java/org/support/project/knowledge/websocket/NotifyAction.java +++ b/src/main/java/org/support/project/knowledge/websocket/NotifyAction.java @@ -16,7 +16,11 @@ public class NotifyAction extends Observable { @Override public void notifyObservers(Object arg) { if (!(arg instanceof Notify)) { - throw new ArgumentException("arg is invalid. only Notify.class"); + if (arg == null) { + throw new ArgumentException("notify is invalid. only Notify.class. notify is null"); + } else { + throw new ArgumentException("notify is invalid. only Notify.class. notify is " + arg.getClass().getName()); + } } setChanged(); super.notifyObservers(arg); diff --git a/src/main/resources/appresource.properties b/src/main/resources/appresource.properties index cae156f57..05ad916b5 100644 --- a/src/main/resources/appresource.properties +++ b/src/main/resources/appresource.properties @@ -123,8 +123,19 @@ knowledge.navbar.data.backup=Backup & Restore knowledge.auth.description=Prompts for sign-in is required functions.
(Such as knowledge of editing is required sign-in) knowledge.auth.signin=Sign In knowledge.auth.signup=Sign Up +knowledge.auth.forgot.password=Forgot your password? knowledge.auth.label.mail=Mail Address +knowledge.auth.label.id=ID knowledge.auth.label.password=Password +knowledge.auth.title.forgot.password=Forgot password +knowledge.auth.msg.forgot.password=Please enter the email address of your account +knowledge.auth.label.back.to.signin=Back to Sign In +knowledge.auth.label.request.init.passwoed=you will send the password initialization mail +knowledge.auth.msg.accept.request=I have accepted the request of password initialization. Because we send an email for password initialization to
specified e-mail address, please complete the processing. +knowledge.auth.msg.change.password=Please complete the initialization by entering the password for the account +knowledge.auth.label.change.password=Password initialization +knowledge.auth.msg.changed=The password I have been initialized. Please try to sign in. +knowledge.auth.label.back.top=Back to Top knowledge.top.description=Knowledge is a free information sharing service of open source knowledge.top.use.button=Show knowledges @@ -198,13 +209,18 @@ knowledge.account.label.icon.drop=The icon image, here and drop knowledge.account.label.icon.select=Select icon knowledge.account.label.password.msg=(input to change password) knowledge.account.delete=Thank you for your use +knowledge.account.change.email=Change E-mail +knowledge.account.changekey.title=Change E-mail +knowledge.account.label.email=\u5909\u66f4\u3057\u305f\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff08\u6307\u5b9a\u306e\u30a2\u30c9\u30ec\u30b9\u306b\u5909\u66f4\u78ba\u8a8d\u306e\u305f\u3081\u306e\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3059\uff09 +knowledge.account.changekey.request=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002\u65b0\u3057\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u78ba\u8a8d\u7528\u306e\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3057\u3066\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u51e6\u7406\u3092\u5b8c\u4e86\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +knowledge.account.changekey.complete=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002 knowledge.withdrawal.title=Withdrawal knowledge.withdrawal.msg=You unsubscribe from Knowledge of service.
How do you the knowledge that you have registered up to now?
knowledge.withdrawal.label.remove=Remove knowledge.withdrawal.label.leave=Leave (registrant name will be "deleted user") knowledge.withdrawal.label.bottun=The withdrawal will be made (not cancel) knowledge.withdrawal.label.confirm=Do you really sure you want to run the withdrawal?
can not be undone this process. -knowledge.withdrawal.label.name=deleted user +knowledge.withdrawal.label.name=Removed User knowledge.registration.result.title=Registration Result knowledge.registration.msg.wait=I accept the registration.
use the start of the service, has become necessary to confirm the administrator. Please wait until the confirmation of
administrator. diff --git a/src/main/resources/appresource_ja.properties b/src/main/resources/appresource_ja.properties index f74da613f..c1be2b81e 100644 --- a/src/main/resources/appresource_ja.properties +++ b/src/main/resources/appresource_ja.properties @@ -122,9 +122,20 @@ knowledge.navbar.data.backup=\u30c7\u30fc\u30bf\u306e\u30d0\u30c3\u30af\u30a2\u3 knowledge.auth.description=\u30b5\u30a4\u30f3\u30a4\u30f3\u304c\u5fc5\u8981\u306a\u6a5f\u80fd\u3067\u3059\u3002
(\u30ca\u30ec\u30c3\u30b8\u306e\u7de8\u96c6\u306a\u3069\u306f\u30b5\u30a4\u30f3\u30a4\u30f3\u304c\u5fc5\u8981\u3067\u3059) knowledge.auth.signin=\u30b5\u30a4\u30f3\u30a4\u30f3\u5b9f\u884c -knowledge.auth.signup=\u30e6\u30fc\u30b6\u672a\u767b\u9332\u306e\u4eba\u306f \u2192 \u300c\u30e6\u30fc\u30b6\u65b0\u898f\u767b\u9332\u300d +knowledge.auth.signup=\u30e6\u30fc\u30b6\u672a\u767b\u9332\u306e\u4eba\u306f\u300c\u30e6\u30fc\u30b6\u65b0\u898f\u767b\u9332\u300d\u3067\u304d\u307e\u3059 +knowledge.auth.forgot.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5fd8\u308c\u307e\u3057\u305f\u304b\uff1f knowledge.auth.label.mail=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9 +knowledge.auth.label.id=ID knowledge.auth.label.password=\u30d1\u30b9\u30ef\u30fc\u30c9 +knowledge.auth.title.forgot.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u5fd8\u308c\u306e\u30ea\u30af\u30a8\u30b9\u30c8 +knowledge.auth.msg.forgot.password=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044 +knowledge.auth.label.back.to.signin=\u30b5\u30a4\u30f3\u30a4\u30f3\u3078\u623b\u308b +knowledge.auth.label.request.init.passwoed=\u30d1\u30b9\u30ef\u30fc\u30c9\u521d\u671f\u5316\u30e1\u30fc\u30eb\u3092\u9001\u4fe1 +knowledge.auth.msg.accept.request=\u30d1\u30b9\u30ef\u30fc\u30c9\u521d\u671f\u5316\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002
\u6307\u5b9a\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u521d\u671f\u5316\u7528\u306e\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3057\u305f\u306e\u3067\u3001\u51e6\u7406\u3092\u5b8c\u4e86\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +knowledge.auth.msg.change.password=\u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u521d\u671f\u5316\u3092\u5b8c\u4e86\u3057\u3066\u304f\u3060\u3055\u3044 +knowledge.auth.label.change.password=\u30d1\u30b9\u30ef\u30fc\u30c9\u521d\u671f\u5316 +knowledge.auth.msg.changed=\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u521d\u671f\u5316\u3057\u307e\u3057\u305f\u3002\u30b5\u30a4\u30f3\u30a4\u30f3\u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002 +knowledge.auth.label.back.top=Top\u3078\u623b\u308b knowledge.top.description=Knowledge\u306f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306e\u30d5\u30ea\u30fc\u306a\u60c5\u5831\u5171\u6709\u30b5\u30fc\u30d3\u30b9\u3067\u3059 knowledge.top.use.button=\u60c5\u5831\u3092\u898b\u308b @@ -198,13 +209,18 @@ knowledge.account.label.icon.drop=\u30a2\u30a4\u30b3\u30f3\u753b\u50cf\u3092\u30 knowledge.account.label.icon.select=\u30a2\u30a4\u30b3\u30f3\u3092\u9078\u629e knowledge.account.label.password.msg=(\u5909\u66f4\u3059\u308b\u5834\u5408\u306e\u307f\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044) knowledge.account.delete=\u3054\u5229\u7528\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f +knowledge.account.change.email=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5909\u66f4\u3059\u308b +knowledge.account.changekey.title=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4 +knowledge.account.label.email=\u5909\u66f4\u3057\u305f\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff08\u6307\u5b9a\u306e\u30a2\u30c9\u30ec\u30b9\u306b\u5909\u66f4\u78ba\u8a8d\u306e\u305f\u3081\u306e\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3059\uff09 +knowledge.account.changekey.request=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002\u65b0\u3057\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u78ba\u8a8d\u7528\u306e\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3057\u3066\u3001\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u51e6\u7406\u3092\u5b8c\u4e86\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +knowledge.account.changekey.complete=\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5909\u66f4\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002 knowledge.withdrawal.title=\u9000\u4f1a knowledge.withdrawal.msg=Knowledge\u306e\u30b5\u30fc\u30d3\u30b9\u304b\u3089\u9000\u4f1a\u3057\u307e\u3059\u3002
\u4eca\u307e\u3067\u767b\u9332\u3057\u305f\u30ca\u30ec\u30c3\u30b8\u3092\u3069\u3046\u3057\u307e\u3059\u304b\uff1f
knowledge.withdrawal.label.remove=\u524a\u9664\u3059\u308b knowledge.withdrawal.label.leave=\u6b8b\u3059 (\u30ca\u30ec\u30c3\u30b8\u306e\u767b\u9332\u8005\u306f "\u9000\u4f1a\u6e08" \u306b\u306a\u308a\u307e\u3059) knowledge.withdrawal.label.bottun=\u9000\u4f1a\u3059\u308b\uff08\u53d6\u308a\u6d88\u305b\u307e\u305b\u3093\uff09 knowledge.withdrawal.label.confirm=\u672c\u5f53\u306b\u9000\u4f1a\u3092\u5b9f\u884c\u3057\u3066\u3088\u308d\u3057\u3044\u3067\u3059\u304b\uff1f
\u3053\u306e\u51e6\u7406\u306f\u53d6\u308a\u6d88\u305b\u307e\u305b\u3093\u3002 -knowledge.withdrawal.label.name=\u9000\u4f1a\u6e08 +knowledge.withdrawal.label.name=Removed User knowledge.registration.result.title=\u767b\u9332\u53d7\u4ed8\u7d50\u679c knowledge.registration.msg.wait=\u767b\u9332\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002
\u672c\u30b5\u30fc\u30d3\u30b9\u306e\u5229\u7528\u958b\u59cb\u306f\u3001\u7ba1\u7406\u8005\u306e\u78ba\u8a8d\u304c\u5fc5\u8981\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002
\u7ba1\u7406\u8005\u306e\u78ba\u8a8d\u307e\u3067\u3057\u3070\u3089\u304f\u304a\u5f85\u3061\u304f\u3060\u3055\u3044\u3002 diff --git a/src/main/resources/org/support/project/knowledge/mail/mail_confirm.xml b/src/main/resources/org/support/project/knowledge/mail/mail_confirm.xml new file mode 100644 index 000000000..833c44c92 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/mail/mail_confirm.xml @@ -0,0 +1,22 @@ + + + [Knowledge] Confirmation of a new e-mail address + + +Dear {UserName} + +This is the e-mail confirmation of the change e-mail address. +If you click on the following URL, and you can see that your designated e-mail arrives. +After confirmation, the new e-mail address is enabled. + +{URL} + +------------------------------------------ + This e-mail has been sent automatically from the system. + Please understand that it can not reply to this email. + + + + + + diff --git a/src/main/resources/org/support/project/knowledge/mail/mail_confirm_ja.xml b/src/main/resources/org/support/project/knowledge/mail/mail_confirm_ja.xml new file mode 100644 index 000000000..3dc91024a --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/mail/mail_confirm_ja.xml @@ -0,0 +1,22 @@ + + + [Knowledge] 新しいメールアドレスの確認 + + +{UserName} 様 + +メールアドレスの変更確認のメールです。 +以下のURLをクリックすると、ご指定のメールが届いたことが確認できます。 +確認後、新しいメールアドレスが有効になります。 + +{URL} + +------------------------------------------ +※本メールはシステムより自動で送信されています。 + このメールに対する返信は出来ませんので御了承ください。 + + + + + + diff --git a/src/main/resources/org/support/project/knowledge/mail/password_reset.xml b/src/main/resources/org/support/project/knowledge/mail/password_reset.xml new file mode 100644 index 000000000..94b31c3dd --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/mail/password_reset.xml @@ -0,0 +1,23 @@ + + + [Knowledge] Reset Password + + +To {MAIL} + +We have received a request for a password initialization. +Go to the following URL, please complete the initialization of the password. + +{URL} + +※ When you can not initialize within 60 minutes, this email will be disabled. + +------------------------------------------ + This e-mail has been sent automatically from the system. + Please understand that it can not reply to this email. + + + + + + diff --git a/src/main/resources/org/support/project/knowledge/mail/password_reset_ja.xml b/src/main/resources/org/support/project/knowledge/mail/password_reset_ja.xml new file mode 100644 index 000000000..437dc1e17 --- /dev/null +++ b/src/main/resources/org/support/project/knowledge/mail/password_reset_ja.xml @@ -0,0 +1,23 @@ + + + [Knowledge] パスワードリセット + + +{MAIL} 様 + +パスワード初期化のリクエストを受けました。 +以下のURLにアクセスして、パスワードの初期化を完了してください。 + +{URL} + +※60分以内に初期化いただけない場合、本メールは無効となります。 + +------------------------------------------ +※本メールはシステムより自動で送信されています。 + このメールに対する返信は出来ませんので御了承ください。 + + + + + + diff --git a/src/main/webapp/WEB-INF/views/admin/config/system.jsp b/src/main/webapp/WEB-INF/views/admin/config/system.jsp index df59935c5..9b1aabc21 100644 --- a/src/main/webapp/WEB-INF/views/admin/config/system.jsp +++ b/src/main/webapp/WEB-INF/views/admin/config/system.jsp @@ -20,7 +20,7 @@ -

<%= jspUtil.label("knowledge.config.title") %>

+

<%= jspUtil.label("knowledge.config.system.title") %>

diff --git a/src/main/webapp/WEB-INF/views/auth/form.jsp b/src/main/webapp/WEB-INF/views/auth/form.jsp index 98b0b8e0d..2747191d5 100644 --- a/src/main/webapp/WEB-INF/views/auth/form.jsp +++ b/src/main/webapp/WEB-INF/views/auth/form.jsp @@ -45,7 +45,7 @@
- +
" @@ -76,6 +76,11 @@  <%= jspUtil.label("knowledge.auth.signup") %> <% } %> +

+ +  <%= jspUtil.label("knowledge.auth.forgot.password") %> + +
diff --git a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp index f64918e70..cc9e61898 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp @@ -73,12 +73,12 @@
  • - +  <%= jspUtil.label("knowledge.navbar.lang.en") %>
  • - +  <%= jspUtil.label("knowledge.navbar.lang.ja") %>
  • diff --git a/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_request.jsp b/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_request.jsp new file mode 100644 index 000000000..dc8a42872 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_request.jsp @@ -0,0 +1,52 @@ +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page import="org.support.project.knowledge.logic.SystemConfigLogic"%> +<%@page import="org.support.project.common.util.StringUtils"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + +

    <%= jspUtil.label("knowledge.auth.title.forgot.password") %>

    + +
    + + + <%= jspUtil.label("knowledge.auth.msg.forgot.password") %> + +
    + +
    + " + placeholder="Email address" autofocus> +
    +
    +
    +
    + + +  <%= jspUtil.label("knowledge.auth.label.back.to.signin") %> + +
    +
    + + +
    + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_result.jsp b/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_result.jsp new file mode 100644 index 000000000..2ac512885 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/passwordinitialization/forgot_pass_result.jsp @@ -0,0 +1,25 @@ +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page import="org.support.project.knowledge.logic.SystemConfigLogic"%> +<%@page import="org.support.project.common.util.StringUtils"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + +

    <%= jspUtil.label("knowledge.auth.title.forgot.password") %>

    + + <%= jspUtil.label("knowledge.auth.msg.accept.request") %> + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/open/passwordinitialization/password_reset.jsp b/src/main/webapp/WEB-INF/views/open/passwordinitialization/password_reset.jsp new file mode 100644 index 000000000..992f6ed64 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/passwordinitialization/password_reset.jsp @@ -0,0 +1,61 @@ +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page import="org.support.project.knowledge.logic.SystemConfigLogic"%> +<%@page import="org.support.project.common.util.StringUtils"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + +

    <%= jspUtil.label("knowledge.auth.title.forgot.password") %>

    + +
    +
    + + <%= jspUtil.label("knowledge.auth.msg.change.password") %> + +
    + +
    + " + placeholder="Email address" readonly="readonly"> +
    +
    + +
    + + " /> +
    +
    + + " /> +
    + + " /> + +
    +
    + +
    +
    +
    + +
    + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/open/passwordinitialization/reset_result.jsp b/src/main/webapp/WEB-INF/views/open/passwordinitialization/reset_result.jsp new file mode 100644 index 000000000..4419cc439 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/passwordinitialization/reset_result.jsp @@ -0,0 +1,34 @@ +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page import="org.support.project.knowledge.logic.SystemConfigLogic"%> +<%@page import="org.support.project.common.util.StringUtils"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + +

    <%= jspUtil.label("knowledge.auth.title.forgot.password") %>

    + +<%= jspUtil.label("knowledge.auth.msg.changed") %> + + +

    +

    + + +<%= jspUtil.label("knowledge.auth.label.back.top") %> + + + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/protect/account/changekey.jsp b/src/main/webapp/WEB-INF/views/protect/account/changekey.jsp new file mode 100644 index 000000000..35b0fad22 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/protect/account/changekey.jsp @@ -0,0 +1,44 @@ +<%@page import="org.support.project.knowledge.config.SystemConfig"%> +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false" errorPage="/WEB-INF/views/commons/errors/jsp_error.jsp"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + + + + + +

    <%= jspUtil.label("knowledge.account.changekey.title") %>

    + +
    +
    +
    +
    + + " + /> +
    + + + +  <%= jspUtil.label("label.back")%> + +
    +
    +
    + + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/protect/account/complete.jsp b/src/main/webapp/WEB-INF/views/protect/account/complete.jsp new file mode 100644 index 000000000..a5e735ae7 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/protect/account/complete.jsp @@ -0,0 +1,33 @@ +<%@page import="org.support.project.knowledge.config.SystemConfig"%> +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false" errorPage="/WEB-INF/views/commons/errors/jsp_error.jsp"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + + + + + +

    <%= jspUtil.label("knowledge.account.changekey.title") %>

    + +
    +
    + <%= jspUtil.label("knowledge.account.changekey.complete") %> +
    +
    + + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/protect/account/index.jsp b/src/main/webapp/WEB-INF/views/protect/account/index.jsp index e8ca9687b..acbbeaeca 100644 --- a/src/main/webapp/WEB-INF/views/protect/account/index.jsp +++ b/src/main/webapp/WEB-INF/views/protect/account/index.jsp @@ -1,3 +1,4 @@ +<%@page import="org.support.project.knowledge.config.SystemConfig"%> <%@page import="org.support.project.web.util.JspUtil"%> <%@page pageEncoding="UTF-8" isELIgnored="false" session="false" errorPage="/WEB-INF/views/commons/errors/jsp_error.jsp"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> @@ -56,7 +57,12 @@
    - " /> + " + <%= jspUtil.isnot(SystemConfig.USER_ADD_TYPE_VALUE_USER, "userAddType", "readonly=\"readonly\"") %> + /> + <% if (jspUtil.is(SystemConfig.USER_ADD_TYPE_VALUE_MAIL, "userAddType")) { %> +
    <%= jspUtil.label("knowledge.account.change.email") %> + <% } %>
    diff --git a/src/main/webapp/WEB-INF/views/protect/account/saveresult.jsp b/src/main/webapp/WEB-INF/views/protect/account/saveresult.jsp new file mode 100644 index 000000000..a1edcf2cd --- /dev/null +++ b/src/main/webapp/WEB-INF/views/protect/account/saveresult.jsp @@ -0,0 +1,33 @@ +<%@page import="org.support.project.knowledge.config.SystemConfig"%> +<%@page import="org.support.project.web.util.JspUtil"%> +<%@page pageEncoding="UTF-8" isELIgnored="false" session="false" errorPage="/WEB-INF/views/commons/errors/jsp_error.jsp"%> +<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> +<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> + +<% JspUtil jspUtil = new JspUtil(request, pageContext); %> + + + + + + + + + + + + +

    <%= jspUtil.label("knowledge.account.changekey.title") %>

    + +
    +
    + <%= jspUtil.label("knowledge.account.changekey.request") %> +
    +
    + + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 0979e1465..40b216bbf 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -44,7 +44,7 @@ org.support.project.web.filter.AuthenticationFilter ignore-regular-expression - ^/index|^/open|^/template|^/bower|^/images|^/css|^/js|^/favicon.ico|css$|js$|jpg$|jpeg$|gif$|png$|ico$ + ^/index|^/open|^/template|^/bower|^/images|^/css|^/js|^/favicon.ico|css$|js$|jpg$|jpeg$|gif$|png$|ico$|html$ login-page @@ -82,7 +82,7 @@ ignore-regular-expression - ^/ws|^/template|^/bower|css$|js$|jpg$|jpeg$|gif$|png$ + ^/ws|^/template|^/bower|css$|js$|jpg$|jpeg$|gif$|png$|ico$|html$