From 1051f208c6620f983f0556fa5220bc3b75719de0 Mon Sep 17 00:00:00 2001 From: koda Date: Wed, 7 Jan 2015 00:34:48 +0900 Subject: [PATCH] =?UTF-8?q?0.3.1=20=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- .../redcomet/knowledge/bat/MailSendBat.java | 11 ++ .../redcomet/knowledge/config/AppConfig.java | 1 + .../knowledge/config/SystemConfig.java | 27 ++++ .../control/admin/ConfigControl.java | 89 +++++++++++ .../knowledge/control/admin/MailControl.java | 115 ++++++++++++++ .../knowledge/control/open/SignupControl.java | 146 ++++++++++++++++++ .../redcomet/knowledge/deploy/InitDB.java | 8 +- .../deploy/v0_0_1/InitializeSystem.java | 5 +- .../deploy/v0_3_0/Migrate_0_3_0.java | 3 +- .../deploy/v0_3_1/Migrate_0_3_1.java | 22 +++ .../knowledge/deploy/v0_3_1/migrate.sql | 5 + .../redcomet/knowledge/logic/MailLogic.java | 24 +++ .../knowledge/logic/SystemConfigLogic.java | 37 +++++ .../WEB-INF/views/admin/config/config.jsp | 85 ++++++++++ .../WEB-INF/views/admin/mail/config.jsp | 84 ++++++++++ src/main/webapp/WEB-INF/views/auth/form.jsp | 10 ++ .../views/commons/layout/commonNavbar.jsp | 13 ++ .../WEB-INF/views/open/signup/mail_sended.jsp | 30 ++++ .../open/signup/provisional_registration.jsp | 27 ++++ .../WEB-INF/views/open/signup/signup.jsp | 54 +++++++ .../WEB-INF/views/protect/account/index.jsp | 4 +- 22 files changed, 794 insertions(+), 10 deletions(-) create mode 100644 src/main/java/redcomet/knowledge/bat/MailSendBat.java create mode 100644 src/main/java/redcomet/knowledge/config/SystemConfig.java create mode 100644 src/main/java/redcomet/knowledge/control/admin/ConfigControl.java create mode 100644 src/main/java/redcomet/knowledge/control/admin/MailControl.java create mode 100644 src/main/java/redcomet/knowledge/control/open/SignupControl.java create mode 100644 src/main/java/redcomet/knowledge/deploy/v0_3_1/Migrate_0_3_1.java create mode 100644 src/main/java/redcomet/knowledge/deploy/v0_3_1/migrate.sql create mode 100644 src/main/java/redcomet/knowledge/logic/MailLogic.java create mode 100644 src/main/java/redcomet/knowledge/logic/SystemConfigLogic.java create mode 100644 src/main/webapp/WEB-INF/views/admin/config/config.jsp create mode 100644 src/main/webapp/WEB-INF/views/admin/mail/config.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/signup/mail_sended.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/signup/provisional_registration.jsp create mode 100644 src/main/webapp/WEB-INF/views/open/signup/signup.jsp diff --git a/pom.xml b/pom.xml index d831b1016..e79de8e7a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ redcomet knowledge war - 0.3.0 + 0.3.1 webapp for knowledge https://support-project.org/ @@ -17,7 +17,7 @@ redcomet web - 0.3.0 + 0.3.1 diff --git a/src/main/java/redcomet/knowledge/bat/MailSendBat.java b/src/main/java/redcomet/knowledge/bat/MailSendBat.java new file mode 100644 index 000000000..84bd7bfac --- /dev/null +++ b/src/main/java/redcomet/knowledge/bat/MailSendBat.java @@ -0,0 +1,11 @@ +package redcomet.knowledge.bat; + +/** + * メールの送信処理は、時間がかかるため、バッチ処理の中で処理する + * + * @author Koda + * + */ +public class MailSendBat { + +} diff --git a/src/main/java/redcomet/knowledge/config/AppConfig.java b/src/main/java/redcomet/knowledge/config/AppConfig.java index 1ded72e2e..f65687ce2 100644 --- a/src/main/java/redcomet/knowledge/config/AppConfig.java +++ b/src/main/java/redcomet/knowledge/config/AppConfig.java @@ -2,6 +2,7 @@ public class AppConfig extends redcomet.web.config.AppConfig { + public static final String SYSTEM_NAME = "knowledge"; private String indexPath; diff --git a/src/main/java/redcomet/knowledge/config/SystemConfig.java b/src/main/java/redcomet/knowledge/config/SystemConfig.java new file mode 100644 index 000000000..78323e8cb --- /dev/null +++ b/src/main/java/redcomet/knowledge/config/SystemConfig.java @@ -0,0 +1,27 @@ +package redcomet.knowledge.config; + +public class SystemConfig { + public static final String ROLE_ADMIN = "admin"; + public static final String ROLE_USER = "user"; + + /** ユーザ登録のやりかたを判定するシステム設定のラベル */ + public static final String USER_ADD_TYPE = "USER_ADD_TYPE"; + /** ユーザ登録のやりかた: 管理者が登録(デフォルト) */ + public static final String USER_ADD_TYPE_VALUE_ADMIN = "ADMIN"; + /** ユーザ登録のやりかた: ユーザ自身で登録し、管理者が承認(メール通知あり) */ + public static final String USER_ADD_TYPE_VALUE_APPROVE = "APPROVE"; + /** ユーザ登録のやりかた: ユーザ自身で登録(メールアドレスのチェック無し) */ + public static final String USER_ADD_TYPE_VALUE_USER = "USER"; + /** ユーザ登録のやりかた: ユーザ自身で登録(メールアドレスのチェックあり) */ + public static final String USER_ADD_TYPE_VALUE_MAIL = "MAIL"; + + /** ユーザ登録を実施した後、通知するか(ON/OFF) */ + public static final String USER_ADD_NOTIFY = "USER_ADD_NOTIFY"; + /** ユーザ登録を実施した後、通知する(ON) */ + public static final String USER_ADD_NOTIFY_ON = "ON"; + /** ユーザ登録を実施した後、通知しない(OFF) */ + public static final String USER_ADD_NOTIFY_OFF = "OFF"; + + + +} diff --git a/src/main/java/redcomet/knowledge/control/admin/ConfigControl.java b/src/main/java/redcomet/knowledge/control/admin/ConfigControl.java new file mode 100644 index 000000000..7d6dcbc26 --- /dev/null +++ b/src/main/java/redcomet/knowledge/control/admin/ConfigControl.java @@ -0,0 +1,89 @@ +package redcomet.knowledge.control.admin; + +import java.util.ArrayList; +import java.util.List; + +import redcomet.common.bean.ValidateError; +import redcomet.knowledge.config.AppConfig; +import redcomet.knowledge.config.SystemConfig; +import redcomet.knowledge.control.Control; +import redcomet.web.annotation.Auth; +import redcomet.web.boundary.Boundary; +import redcomet.web.dao.MailConfigsDao; +import redcomet.web.dao.SystemConfigsDao; +import redcomet.web.entity.MailConfigsEntity; +import redcomet.web.entity.SystemConfigsEntity; + +public class ConfigControl extends Control { + + + + /** + * 一般設定画面を表示 + * @return + */ + @Auth(roles="admin") + public Boundary config() { + 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()); + + SystemConfigsEntity userAddNotify = dao.selectOnKey(SystemConfig.USER_ADD_NOTIFY, AppConfig.SYSTEM_NAME); + if (userAddNotify == null) { + userAddNotify = new SystemConfigsEntity(SystemConfig.USER_ADD_NOTIFY, AppConfig.SYSTEM_NAME); + userAddNotify.setConfigValue(SystemConfig.USER_ADD_NOTIFY_OFF); + } + setAttribute("userAddNotify", userAddNotify.getConfigValue()); + + return forward("config.jsp"); + } + + + + /** + * メールの設定を保存 + * @return + */ + @Auth(roles="admin") + public Boundary save() { + List errors = new ArrayList<>(); + String type = getParam("userAddType"); + String notify = getParam("userAddNotify"); + // メール送信の場合、メールの設定が完了しているかチェック + if ((type != null && type.equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) + || (notify != null && notify.equals(SystemConfig.USER_ADD_NOTIFY_ON))) { + MailConfigsDao mailConfigsDao = MailConfigsDao.get(); + MailConfigsEntity mailConfigsEntity = mailConfigsDao.selectOnKey(AppConfig.SYSTEM_NAME); + if (mailConfigsEntity == null) { + ValidateError error = new ValidateError("メールを送る場合、メールの送信の設定が必須です"); + errors.add(error); + } + } + if (!errors.isEmpty()) { + setResult(null, errors); + return forward("config.jsp"); + } + + SystemConfigsDao dao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = new SystemConfigsEntity(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + userAddType.setConfigValue(type); + dao.save(userAddType); + + SystemConfigsEntity userAddNotify = new SystemConfigsEntity(SystemConfig.USER_ADD_NOTIFY, AppConfig.SYSTEM_NAME); + userAddNotify.setConfigValue(notify); + dao.save(userAddNotify); + + String successMsg = "保存しました"; + setResult(successMsg, errors); + + return forward("config.jsp"); + } + + + +} diff --git a/src/main/java/redcomet/knowledge/control/admin/MailControl.java b/src/main/java/redcomet/knowledge/control/admin/MailControl.java new file mode 100644 index 000000000..b5357fd52 --- /dev/null +++ b/src/main/java/redcomet/knowledge/control/admin/MailControl.java @@ -0,0 +1,115 @@ +package redcomet.knowledge.control.admin; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; + +import redcomet.common.bean.ValidateError; +import redcomet.common.config.INT_FLAG; +import redcomet.common.util.PasswordUtil; +import redcomet.common.util.StringUtils; +import redcomet.knowledge.config.AppConfig; +import redcomet.knowledge.control.Control; +import redcomet.web.annotation.Auth; +import redcomet.web.boundary.Boundary; +import redcomet.web.dao.MailConfigsDao; +import redcomet.web.entity.MailConfigsEntity; + +public class MailControl extends Control { + + /** + * メールの設定画面を表示 + * @return + */ + @Auth(roles="admin") + public Boundary config() { + MailConfigsDao dao = MailConfigsDao.get(); + MailConfigsEntity entity = dao.selectOnKey(AppConfig.SYSTEM_NAME); + if (entity == null) { + entity = new MailConfigsEntity(); + } + entity.setSystemName(AppConfig.SYSTEM_NAME); + entity.setSmtpPassword(""); // パスワードは送らない + setAttributeOnProperty(entity); + + return forward("config.jsp"); + } + + + /** + * メールの設定を保存 + * @return + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws InvalidKeyException + */ + @Auth(roles="admin") + public Boundary save() throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { + List errors = new ArrayList<>(); + errors.addAll(MailConfigsEntity.get().validate(getParams())); + + String type = getParam("authType"); + //認証がONの場合のチェック + if (type.equals(String.valueOf(INT_FLAG.ON.getValue()))) { + if (StringUtils.isEmpty(getParam("smtpId"))) { + ValidateError error = new ValidateError("認証する場合、SMTP IDは必須です"); + errors.add(error); + } + if (StringUtils.isEmpty(getParam("smtpPassword"))) { + ValidateError error = new ValidateError("認証する場合、SMTP パスワードは必須です"); + errors.add(error); + } + } + if (!errors.isEmpty()) { + setResult(null, errors); + return forward("config.jsp"); + } + + MailConfigsEntity entity = super.getParams(MailConfigsEntity.class); + + // パスワードは暗号化する + String salt = PasswordUtil.getSalt(); + entity.setSmtpPassword(PasswordUtil.encrypt(entity.getSmtpPassword(), salt)); + entity.setSalt(salt); + + MailConfigsDao dao = MailConfigsDao.get(); + entity = dao.save(entity); + setAttributeOnProperty(entity); + + // TODO テストでメール送信(更新したユーザのメールアドレス宛に、メールを送る) + + String successMsg = "保存しました"; + setResult(successMsg, errors); + + return forward("config.jsp"); + } + + + + /** + * メールの設定を削除 + * @return + */ + @Auth(roles="admin") + public Boundary delete() { + MailConfigsDao dao = MailConfigsDao.get(); + dao.physicalDelete(AppConfig.SYSTEM_NAME); // 物理削除で消してしまう + + MailConfigsEntity entity = new MailConfigsEntity(); + entity.setSystemName(AppConfig.SYSTEM_NAME); + setAttributeOnProperty(entity); + + addMsgInfo("メールの設定を削除しました"); + + return forward("config.jsp"); + } + + +} diff --git a/src/main/java/redcomet/knowledge/control/open/SignupControl.java b/src/main/java/redcomet/knowledge/control/open/SignupControl.java new file mode 100644 index 000000000..79bc0db20 --- /dev/null +++ b/src/main/java/redcomet/knowledge/control/open/SignupControl.java @@ -0,0 +1,146 @@ +package redcomet.knowledge.control.open; + +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import redcomet.aop.Aspect; +import redcomet.common.bean.ValidateError; +import redcomet.common.util.StringUtils; +import redcomet.common.validate.Validator; +import redcomet.common.validate.ValidatorFactory; +import redcomet.di.Container; +import redcomet.knowledge.config.AppConfig; +import redcomet.knowledge.config.SystemConfig; +import redcomet.knowledge.control.Control; +import redcomet.knowledge.logic.MailLogic; +import redcomet.knowledge.logic.UserLogic; +import redcomet.web.boundary.Boundary; +import redcomet.web.common.HttpStatus; +import redcomet.web.dao.ProvisionalRegistrationsDao; +import redcomet.web.dao.SystemConfigsDao; +import redcomet.web.dao.UsersDao; +import redcomet.web.entity.ProvisionalRegistrationsEntity; +import redcomet.web.entity.SystemConfigsEntity; +import redcomet.web.entity.UsersEntity; +import redcomet.web.logic.AuthenticationLogic; +import redcomet.web.logic.impl.DefaultAuthenticationLogicImpl; + +public class SignupControl extends Control { + + /** + * ユーザのサインアップ画面を表示 + * @return + */ + public Boundary view() { + return forward("signup.jsp"); + } + + /** + * 新規登録処理を保存 + * @return + */ + public Boundary save() { + SystemConfigsDao systemConfigsDao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = systemConfigsDao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + // ユーザによるデータの追加は認められていない + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN)) { + // ユーザによるデータの追加は認められていない + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + + List errors = validate(); + if (!errors.isEmpty()) { + setResult(null, errors); + return forward("signup.jsp"); + } + + if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_USER)) { + // ユーザが自分で登録 + addUser(); + addMsgInfo("ユーザ登録しました"); + return redirect(getRequest().getContextPath()); + } else if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL) + || userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_APPROVE)) { + // ユーザは仮登録を行う + ProvisionalRegistrationsEntity entity = addProvisionalRegistration(); + if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_MAIL)) { + // 招待のメールを送信 + MailLogic mailLogic = MailLogic.get(); + mailLogic.sendInvitation(entity); + return forward("mail_sended.jsp"); + } else { + // 管理者へメール通知 + return forward("provisional_registration.jsp"); + } + } + return sendError(HttpStatus.SC_404_NOT_FOUND, "NOT FOUND"); + } + + + + /** + * 仮登録 + * @return + */ + @Aspect(advice=redcomet.ormapping.transaction.Transaction.class) + private ProvisionalRegistrationsEntity addProvisionalRegistration() { + ProvisionalRegistrationsEntity entity = super.getParams(ProvisionalRegistrationsEntity.class); + String id = UUID.randomUUID().toString() + "-" + new Date().getTime() + "-" + UUID.randomUUID().toString(); + entity.setId(id); + ProvisionalRegistrationsDao dao = ProvisionalRegistrationsDao.get(); + //既に仮登録が行われたユーザ(メールアドレス)でも、再度仮登録できる + //ただし、以前の登録は無効にする + dao.deleteOnUserKey(entity.getUserKey()); + //データ登録 + entity = dao.insert(entity); + return entity; + } + + /** + * ユーザ追加 + */ + private void addUser() { + // エラーが無い場合のみ登録 + UsersEntity user = super.getParams(UsersEntity.class); + String[] roles = {SystemConfig.ROLE_USER}; + user = UserLogic.get().insert(user, roles, getLoginedUser()); + setAttributeOnProperty(user); + + // ログイン処理 + AuthenticationLogic logic = Container.getComp(DefaultAuthenticationLogicImpl.class); + logic.setSession(user.getUserKey(), getRequest()); + } + + /** + * 入力チェック + * @return + */ + private List validate() { + List errors = UsersEntity.get().validate(getParams()); + if (!StringUtils.isEmpty(getParam("password"))) { + if (!getParam("password").equals(getParam("confirm_password", String.class))) { + ValidateError error = new ValidateError("PasswordとConfirm Passwordが違っています"); + errors.add(error); + } + } + UsersDao dao = UsersDao.get(); + UsersEntity user = dao.selectOnUserKey(getParam("userKey")); + if (user != null) { + ValidateError error = new ValidateError("既に登録されているEmail Addressです"); + errors.add(error); + } + + Validator validator = ValidatorFactory.getInstance(Validator.MAIL); + ValidateError error = validator.validate(getParam("userKey"), "Email Address"); + if (error != null) { + errors.add(error); + } + return errors; + } + + +} diff --git a/src/main/java/redcomet/knowledge/deploy/InitDB.java b/src/main/java/redcomet/knowledge/deploy/InitDB.java index 8e30525ae..c6f920181 100644 --- a/src/main/java/redcomet/knowledge/deploy/InitDB.java +++ b/src/main/java/redcomet/knowledge/deploy/InitDB.java @@ -8,6 +8,7 @@ import redcomet.common.log.LogFactory; import redcomet.knowledge.deploy.v0_0_1.InitializeSystem; import redcomet.knowledge.deploy.v0_3_0.Migrate_0_3_0; +import redcomet.knowledge.deploy.v0_3_1.Migrate_0_3_1; import redcomet.web.dao.SystemsDao; import redcomet.web.entity.SystemsEntity; @@ -16,18 +17,19 @@ public class InitDB { /** ログ */ private static Log LOG = LogFactory.getLog(InitDB.class); - private static final String SYSTEM_NAME = "knowledge"; + private static final String SYSTEM_NAME = redcomet.knowledge.config.AppConfig.SYSTEM_NAME; private static final Map MAP = new LinkedHashMap<>(); private static final Migrate INIT = InitializeSystem.get(); - private static final String CURRENT = "0.3.0"; + private static final String CURRENT = "0.3.1"; public InitDB() { super(); // MAP.put("0.0.1", InitializeSystem.get()); // MAP.put("0.1.0", Migrate_0_1_0.get()); MAP.put("0.2.0", INIT); // 初期公開バージョン - MAP.put(CURRENT, Migrate_0_3_0.get()); + MAP.put("0.3.0", Migrate_0_3_0.get()); + MAP.put(CURRENT, Migrate_0_3_1.get()); } public static void main(String[] args) throws Exception { diff --git a/src/main/java/redcomet/knowledge/deploy/v0_0_1/InitializeSystem.java b/src/main/java/redcomet/knowledge/deploy/v0_0_1/InitializeSystem.java index 9a02bc420..eb322b978 100644 --- a/src/main/java/redcomet/knowledge/deploy/v0_0_1/InitializeSystem.java +++ b/src/main/java/redcomet/knowledge/deploy/v0_0_1/InitializeSystem.java @@ -1,5 +1,6 @@ package redcomet.knowledge.deploy.v0_0_1; +import redcomet.knowledge.config.SystemConfig; import redcomet.knowledge.deploy.Migrate; import redcomet.ormapping.tool.dao.InitializeDao; import redcomet.web.dao.RolesDao; @@ -26,13 +27,13 @@ private void addInitDatas() { //権限の追加 RolesEntity adminRole = RolesEntity.get(); adminRole.setRoleId(1); - adminRole.setRoleKey("admin"); + adminRole.setRoleKey(SystemConfig.ROLE_ADMIN); adminRole.setRoleName("管理者権限"); RolesDao.get().insert(adminRole); RolesEntity userRole = RolesEntity.get(); userRole.setRoleId(2); - userRole.setRoleKey("user"); + userRole.setRoleKey(SystemConfig.ROLE_USER); userRole.setRoleName("一般ユーザ権限"); RolesDao.get().insert(userRole); diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java index 0875c3f71..352bf4069 100644 --- a/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_0/Migrate_0_3_0.java @@ -13,7 +13,8 @@ public static Migrate_0_3_0 get() { public boolean doMigrate() throws Exception { InitializeDao initializeDao = InitializeDao.get(); String[] sqlpaths = { - "/redcomet/knowledge/deploy/v0_3_0/migrate.sql" + "/redcomet/knowledge/deploy/v0_3_0/migrate.sql", + "/redcomet/knowledge/deploy/v0_3_0/migrate2.sql" }; initializeDao.initializeDatabase(sqlpaths); return true; diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_1/Migrate_0_3_1.java b/src/main/java/redcomet/knowledge/deploy/v0_3_1/Migrate_0_3_1.java new file mode 100644 index 000000000..4b90697ed --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_1/Migrate_0_3_1.java @@ -0,0 +1,22 @@ +package redcomet.knowledge.deploy.v0_3_1; + +import redcomet.knowledge.deploy.Migrate; +import redcomet.ormapping.tool.dao.InitializeDao; + +public class Migrate_0_3_1 implements Migrate { + + public static Migrate_0_3_1 get() { + return redcomet.di.Container.getComp(Migrate_0_3_1.class); + } + + @Override + public boolean doMigrate() throws Exception { + InitializeDao initializeDao = InitializeDao.get(); + String[] sqlpaths = { + "/redcomet/knowledge/deploy/v0_3_1/migrate.sql" + }; + initializeDao.initializeDatabase(sqlpaths); + return true; + } + +} diff --git a/src/main/java/redcomet/knowledge/deploy/v0_3_1/migrate.sql b/src/main/java/redcomet/knowledge/deploy/v0_3_1/migrate.sql new file mode 100644 index 000000000..a6c600707 --- /dev/null +++ b/src/main/java/redcomet/knowledge/deploy/v0_3_1/migrate.sql @@ -0,0 +1,5 @@ +ALTER TABLE MAIL_CONFIGS ADD COLUMN FROM_ADDRESS character varying(256); +ALTER TABLE MAIL_CONFIGS ADD COLUMN FROM_NAME character varying(256); + +comment on column MAIL_CONFIGS.FROM_ADDRESS is '送信元アドレス'; +comment on column MAIL_CONFIGS.FROM_NAME is '送信元名'; diff --git a/src/main/java/redcomet/knowledge/logic/MailLogic.java b/src/main/java/redcomet/knowledge/logic/MailLogic.java new file mode 100644 index 000000000..e1ff932c2 --- /dev/null +++ b/src/main/java/redcomet/knowledge/logic/MailLogic.java @@ -0,0 +1,24 @@ +package redcomet.knowledge.logic; + +import redcomet.common.log.Log; +import redcomet.common.log.LogFactory; +import redcomet.di.Container; +import redcomet.web.entity.ProvisionalRegistrationsEntity; + +public class MailLogic { + /** ログ */ + private static Log LOG = LogFactory.getLog(MailLogic.class); + + public static MailLogic get() { + return Container.getComp(MailLogic.class); + } + + public void sendInvitation(ProvisionalRegistrationsEntity entity) { + // TODO Auto-generated method stub + + } + + + + +} diff --git a/src/main/java/redcomet/knowledge/logic/SystemConfigLogic.java b/src/main/java/redcomet/knowledge/logic/SystemConfigLogic.java new file mode 100644 index 000000000..493181718 --- /dev/null +++ b/src/main/java/redcomet/knowledge/logic/SystemConfigLogic.java @@ -0,0 +1,37 @@ +package redcomet.knowledge.logic; + +import redcomet.common.log.Log; +import redcomet.common.log.LogFactory; +import redcomet.di.Container; +import redcomet.knowledge.config.AppConfig; +import redcomet.knowledge.config.SystemConfig; +import redcomet.web.dao.SystemConfigsDao; +import redcomet.web.entity.SystemConfigsEntity; + +public class SystemConfigLogic { + /** ログ */ + private static Log LOG = LogFactory.getLog(SystemConfigLogic.class); + + public static SystemConfigLogic get() { + return Container.getComp(SystemConfigLogic.class); + } + + /** + * ユーザ自身の手でユーザ追加のリクエストを出せるかチェック + * @return + */ + public boolean isUserAddAble() { + SystemConfigsDao systemConfigsDao = SystemConfigsDao.get(); + SystemConfigsEntity userAddType = systemConfigsDao.selectOnKey(SystemConfig.USER_ADD_TYPE, AppConfig.SYSTEM_NAME); + if (userAddType == null) { + return false; + } + if (userAddType.getConfigValue().equals(SystemConfig.USER_ADD_TYPE_VALUE_ADMIN)) { + return false; + } + return true; + } + + + +} diff --git a/src/main/webapp/WEB-INF/views/admin/config/config.jsp b/src/main/webapp/WEB-INF/views/admin/config/config.jsp new file mode 100644 index 000000000..3008d5c2d --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/config/config.jsp @@ -0,0 +1,85 @@ +<%@page import="redcomet.knowledge.config.SystemConfig"%> +<%@page import="redcomet.common.config.INT_FLAG"%> +<%@page import="redcomet.knowledge.vo.Roles"%> +<%@page import="redcomet.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); %> + + + + + + + + + + + + + + + +
+ +
+
+ +
+ <%-- + +
+ +
+ --%> + +
+ + <%-- +
+
+ +
+ +
+ --%> + + +
+ + +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/admin/mail/config.jsp b/src/main/webapp/WEB-INF/views/admin/mail/config.jsp new file mode 100644 index 000000000..1e28e236e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/admin/mail/config.jsp @@ -0,0 +1,84 @@ +<%@page import="redcomet.common.config.INT_FLAG"%> +<%@page import="redcomet.knowledge.vo.Roles"%> +<%@page import="redcomet.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); %> + + + + + + + + + + + + + + + +
+ +
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + + + + +
+ + +
+ +
+ diff --git a/src/main/webapp/WEB-INF/views/auth/form.jsp b/src/main/webapp/WEB-INF/views/auth/form.jsp index d9b847522..c69719d96 100644 --- a/src/main/webapp/WEB-INF/views/auth/form.jsp +++ b/src/main/webapp/WEB-INF/views/auth/form.jsp @@ -1,3 +1,4 @@ +<%@page import="redcomet.knowledge.logic.SystemConfigLogic"%> <%@page import="redcomet.common.util.StringUtils"%> <%@page pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> @@ -90,6 +91,15 @@ body { + +<% if (SystemConfigLogic.get().isUserAddAble()) { %> +
+ +  ユーザ新規登録 + +<% } %> + + 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 b23ce5b90..deed86131 100644 --- a/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp +++ b/src/main/webapp/WEB-INF/views/commons/layout/commonNavbar.jsp @@ -50,6 +50,19 @@  Users + +
  • + +  General Config + +
  • + <%-- +
  • + +  Mail Config + +
  • + --%> <% } %> diff --git a/src/main/webapp/WEB-INF/views/open/signup/mail_sended.jsp b/src/main/webapp/WEB-INF/views/open/signup/mail_sended.jsp new file mode 100644 index 000000000..4c1c82ee6 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/signup/mail_sended.jsp @@ -0,0 +1,30 @@ +<%@page import="redcomet.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); %> + + + + + + + + + + + + +サービスへの招待メールを送信しました。
    +受信したメールから、ユーザ登録を完了するとログイン出来るようになります。
    + +
    +※注意:メーラーによっては、招待のメールが迷惑メールに入ってしまうことがあります。
    +迷惑メールとして届いていないか確認してください。 + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/open/signup/provisional_registration.jsp b/src/main/webapp/WEB-INF/views/open/signup/provisional_registration.jsp new file mode 100644 index 000000000..5deb49f6e --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/signup/provisional_registration.jsp @@ -0,0 +1,27 @@ +<%@page import="redcomet.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); %> + + + + + + + + + + + + +登録を受け付けました。
    +本サービスの利用開始は、管理者の確認が必要になっています。
    +管理者の確認までしばらくお待ちください。 + +
    + +
    + diff --git a/src/main/webapp/WEB-INF/views/open/signup/signup.jsp b/src/main/webapp/WEB-INF/views/open/signup/signup.jsp new file mode 100644 index 000000000..e911a7409 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/open/signup/signup.jsp @@ -0,0 +1,54 @@ +<%@page import="redcomet.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); %> + + + + + + + + + + + + + +

    ユーザ新規登録

    + +
    +
    +
    +
    + + +
    +
    + + +
    + +
    + + +
    +
    + + +
    + + + +
    +
    +
    + + +
    + +
    + 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 fdb4538aa..df5b971d0 100644 --- a/src/main/webapp/WEB-INF/views/protect/account/index.jsp +++ b/src/main/webapp/WEB-INF/views/protect/account/index.jsp @@ -53,11 +53,11 @@
    - +
    - +