Skip to content

Commit

Permalink
Fix v1.10.0 (#187)
Browse files Browse the repository at this point in the history
* fix: secure and dbver #186 
* fix #184
  • Loading branch information
devezhao authored Jun 22, 2020
1 parent cae9421 commit 9364e5b
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>com.rebuild</groupId>
<artifactId>rebuild</artifactId>
<packaging>war</packaging>
<version>1.10.0</version>
<version>1.10.1</version>
<name>rebuild</name>
<description>Building your business-systems freely!</description>
<url>https://getrebuild.com/</url>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/rebuild/server/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public final class Application {

/** Rebuild Version
*/
public static final String VER = "1.10.0";
public static final String VER = "1.10.1";
/** Rebuild Build
*/
public static final int BUILD = 11000;
public static final int BUILD = 11001;

/** Logging for Global
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package com.rebuild.server.helper;

import com.rebuild.server.Application;
import com.rebuild.server.helper.setup.InstallState;
import com.rebuild.server.helper.setup.SetupException;
import com.rebuild.utils.AES;
Expand Down Expand Up @@ -42,7 +43,7 @@ protected void loadProperties(Properties props) throws IOException {

props.putAll(fromInstallFile());
this.afterLoad(props);
LOG.info("Application properties : " + props);
if (Application.devMode()) LOG.info("Application properties : " + props);

setNullValue(StringUtils.EMPTY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void upgradeQuietly() {
* @return
*/
public int getDbVer() {
String dbVer = SysConfiguration.get(ConfigurableItem.DBVer);
String dbVer = SysConfiguration.get(ConfigurableItem.DBVer, true);
return ObjectUtils.toInt(dbVer, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rebuild/utils/AES.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static String decryptQuietly(String input) {
try {
return decrypt(input);
} catch (RebuildException ex) {
LOG.debug("Decrypting error (Use blank input) : " + input);
LOG.warn("Decrypting error (Use blank input) : " + input);
return StringUtils.EMPTY;
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/rebuild/web/user/signin/LoginControll.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
import cn.devezhao.commons.web.WebUtils;
import cn.devezhao.persist4j.Record;
import cn.devezhao.persist4j.engine.ID;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.api.LoginToken;
import com.rebuild.api.AuthTokenManager;
import com.rebuild.api.LoginToken;
import com.rebuild.server.Application;
import com.rebuild.server.helper.ConfigurableItem;
import com.rebuild.server.helper.License;
Expand Down Expand Up @@ -315,11 +314,11 @@ public void getLiveWallpaper(HttpServletResponse response) throws IOException {
return;
}

JSON ret = License.siteApi("api/misc/bgimg", true);
JSONObject ret = License.siteApi("api/misc/bgimg", true);
if (ret == null) {
writeFailure(response);
} else {
writeSuccess(response, ((JSONObject) ret).getString("url"));
writeSuccess(response, ret.getString("url"));
}
}
}
18 changes: 2 additions & 16 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# for initial
# !!! THIS FILE ONLY FOR DEV MODE !!!
# More configurable items see `ConfigurableItem.java`
# You can remove/add the `.aes` suffix to use texts of plain/encrypted
# You can remove/add the `.aes` suffix to use value of plain/encrypted

# Cloud Storage - Use https://www.qiniu.com/
StorageURL=//qn-cdn.getrebuild.com/
Expand All @@ -24,17 +24,3 @@ MailName=REBUILD
CacheHost=127.0.0.1
CachePort=16379
CachePassword.aes=vXwBKYUosMpJRO9jeG9+IA==

# System General
HomeURL=
DataDirectory=
EnableRecentlyUsed=
OpenSignUp=
LiveWallpaper=
FileSharable=
MarkWatermark=
PasswordPolicy=
RevisionHistoryKeepingDays=
RecycleBinKeepingDays=
DBBackupsEnable=
DBBackupsKeepingDays=
10 changes: 5 additions & 5 deletions src/main/resources/scripts/db-init.sql
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- !!! MYSQL VERSION NOTICE !!!
-- IN 5.7 OR ABOVE, YOU SHOULD REMOVED THESE SQL_MODES IN my.cnf/my.ini FIRST.
-- ONLY_FULL_GROUP_BY
-- IN 8.0 OR ABOVE, ONLY SUPPORTS mysql_native_password AUTHENTICATION MODE
-- default_authentication_plugin=mysql_native_password
-- IN 5.7 OR ABOVE :
-- YOU SHOULD REMOVE `ONLY_FULL_GROUP_BY` SQL_MODES IN my.cnf/my.ini
-- IN 8.0 OR ABOVE :
-- ONLY SUPPORT mysql_native_password AUTHENTICATION MODE. Add `default_authentication_plugin=mysql_native_password` TO my.cnf/my.ini

-- #1 database/user
-- 首次使用请移除以下注释以创建数据库和用户
Expand Down Expand Up @@ -607,6 +607,6 @@ insert into `classification` (`DATA_ID`, `NAME`, `DESCRIPTION`, `OPEN_LEVEL`, `I
('018-0000000000000001', '地区', NULL, 2, 'F', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001'),
('018-0000000000000002', '行业', NULL, 1, 'F', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');

-- DB Version
-- DB Version (see `db-upgrade.sql`)
insert into `system_config` (`CONFIG_ID`, `ITEM`, `VALUE`)
values ('021-9000000000000001', 'DBVer', 25);
2 changes: 1 addition & 1 deletion src/main/resources/scripts/db-upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,4 @@ create table if not exists `login_log` (
index IX0_login_log (`USER`, `LOGIN_TIME`)
)Engine=InnoDB;
insert into `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `CONFIG`, `APPLY_TYPE`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`)
values ('013-9000000000000005', 'LoginLog', '[{"field":"user"},{"field":"loginTime"},{"field":"userAgent"},{"field":"ipAddr"},{"field":"logoutTime"}]', 'DATALIST', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
values ('013-9000000000000005', 'LoginLog', '[{"field":"user"},{"field":"loginTime"},{"field":"userAgent"},{"field":"ipAddr"},{"field":"logoutTime"}]', 'DATALIST', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
2 changes: 1 addition & 1 deletion src/main/webapp/user/login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ $(document).ready(function() {
let btn = $('.login-submit button').button('loading')
let url = '/user/user-login?user=' + $encode(user) + '&passwd=******&autoLogin=' + $val('#autoLogin')
if (!!vcode) url += '&vcode=' + vcode
$.post(url, $encode(passwd), function(res) {
$.post(url, passwd, function(res) {
if (res.error_code == 0){
location.replace($decode($urlp('nexturl') || '../dashboard/home'))
} else if (res.error_msg == 'VCODE') {
Expand Down

0 comments on commit 9364e5b

Please sign in to comment.