Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/6.0.0-dev' into 6.0.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor authored and Victor committed Jan 15, 2021
2 parents 2a3298b + 6f6ebcf commit 8459a68
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,16 @@ public SolrQuery convertToSolrQuery(String searchQuery) {
}

private void prepareSolrQueryPaging(SearchQueryDTO searchQuery, SolrQuery solrQuery) {
PageRequestDTO page;
if (searchQuery.getTerm() != null) {
page = searchQuery.getPage();
} else {
page = new PageRequestDTO(DEFAULT_MAX_SIZE);
}
PageRequestDTO page = searchQuery.getPage();

if (page == null) {
page = new PageRequestDTO();
}

if (StringUtils.isBlank(searchQuery.getTerm()) && page.getSize() == PageRequestDTO.DEFAULT_PAGE_SIZE_FOR_UI) {
page.setSize(DEFAULT_MAX_SIZE);
}

solrQuery.setStart(page.getSkip());
solrQuery.setRows(page.getSize());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class PageRequestDTO {

private static final int DEFAULT_PAGE_SIZE_FOR_UI = 100;
public static final int DEFAULT_PAGE_SIZE_FOR_UI = 100;
private static final int DEFAULT_PAGE_NUMBER = 0;

private PageRequest pageRequest;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/imcode/server/ImcmsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
public static final String LOGIN_URL = "/login";
public static final String LOGOUT_URL = "/login/logged_out.jsp";

public static final int MAXIMUM_PASSWORD_LENGTH = 128;
public static final int MAXIMUM_PASSWORD_LENGTH = 250;
public static final int MINIMUM_PASSWORD_LENGTH = 4;

public static final String VIEW_DOC_PATH = "/viewDoc";
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/imcms.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ error/template_with_name_exists = There is already a template with that name.

error/template_availability_not_changed = Availability doesn't changed.

error/password_length = The password must be 4 to 15 characters long.
error/password_length = The password must be 4 to 250 characters long.

error/passwords_did_not_match = The passwords did not match.

Expand Down Expand Up @@ -1140,7 +1140,7 @@ templates/sv/AdminUserResp.htm/8 = Username <b class="red">*</b>

templates/sv/AdminUserResp.htm/10 = Password <b class="red">*</b>

templates/sv/AdminUserResp.htm/11 = (Min 4 - Max 15 char)
templates/sv/AdminUserResp.htm/11 = (Min 4 - Max 250 char)

templates/sv/AdminUserResp.htm/14 = First name

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/imcms_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ error/servlet/AdminManager/no_parent_id=You must provide the id of a document to
error/servlet/AdminManager/parent_must_be_text_document=The document with the provided id is not a textpage. You can only create new documents based on textpages.<br>If you want, you can create a copy instead.
error/template_with_name_exists=There is already a template with that name.
error/template_availability_not_changed=Availability doesn't changed.
error/password_length=The password must be 4 to 15 characters long.
error/password_length=The password must be 4 to 250 characters long.
error/passwords_did_not_match=The passwords did not match.
error/password_too_weak=The password is too simple.
error/user_must_have_at_least_one_role=You must select at least one role.
Expand Down Expand Up @@ -592,7 +592,7 @@ templates/sv/AdminUserResp.htm/6=Please note that all the (<b class="red">*</b>)
\t in to create a user account!
templates/sv/AdminUserResp.htm/8=Username <b class="red">*</b>
templates/sv/AdminUserResp.htm/10=Password <b class="red">*</b>
templates/sv/AdminUserResp.htm/11=(Min 4 - Max 15 char)
templates/sv/AdminUserResp.htm/11=(Min 4 - Max 250 char)
templates/sv/AdminUserResp.htm/14=First name
templates/sv/AdminUserResp.htm/16=Last name
templates/sv/AdminUserResp.htm/18=Title
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/imcms_sv.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ error/template_with_name_exists = Det finns redan en mall med det namnet.

error/template_availability_not_changed = Tillgänglighet inte förändrats.

error/password_length = L\u00f6senordet m\u00e5ste vara 4 till 15 tecken l\u00e5ngt.
error/password_length = L\u00f6senordet m\u00e5ste vara 4 till 250 tecken l\u00e5ngt.

error/passwords_did_not_match = L\u00f6senorden st\u00e4mde inte \u00f6verens.

Expand Down Expand Up @@ -1152,7 +1152,7 @@ templates/sv/AdminUserResp.htm/8 = Anv\u00e4ndarnamn <b class="red">*</b>

templates/sv/AdminUserResp.htm/10 = L\u00f6senord <b class="red">*</b>

templates/sv/AdminUserResp.htm/11 = (Min 4 - Max 15 tkn)
templates/sv/AdminUserResp.htm/11 = (Min 4 - Max 250 tkn)

templates/sv/AdminUserResp.htm/14 = F\u00f6rnamn

Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/schema.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<schema version="6.94"
<schema version="6.95"
xsi:noNamespaceSchemaLocation="schema.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Expand Down Expand Up @@ -310,5 +310,8 @@
<diff from="6.93" to="6.94">
<script>diff/diff-6.93-6.94-mysql.sql</script>
</diff>
<diff from="6.94" to="6.95">
<script>diff/diff-6.94-6.95-mysql.sql</script>
</diff>
</diffs>
</schema>
10 changes: 10 additions & 0 deletions src/main/resources/sql/diff/diff-6.94-6.95-mysql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SET @schema_version__major_new = 6;
SET @schema_version__minor_new = 95;

ALTER TABLE users MODIFY COLUMN login_name VARCHAR(255) NOT NULL;

ALTER TABLE users MODIFY COLUMN login_password VARCHAR(255) NOT NULL;

UPDATE database_version
SET major = @schema_version__major_new,
minor = @schema_version__minor_new;
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/jsp/imcms/views/Login.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ${"-->"}
</label>
<input id="username" type="text"
name="<%=VerifyUser.REQUEST_PARAMETER__USERNAME%>"
maxlength="50"
maxlength="250"
class="imcms-input imcms-text-box__input">
</div>
</div>
Expand All @@ -80,7 +80,7 @@ ${"-->"}
</label>
<input id="password" type="password"
name="<%=VerifyUser.REQUEST_PARAMETER__PASSWORD%>"
maxlength="50"
maxlength="250"
class="imcms-input imcms-text-box__input">
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/WEB-INF/jsp/imcms/views/UserEdit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ ${"-->"}
<label for="login-name" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/8"/></label>
<input id="login-name" type="text" name="login" class="imcms-input imcms-text-box__input"
maxlength="50" value="<c:out value='${editedUser.login}'/>">
maxlength="250" value="<c:out value='${editedUser.login}'/>">
</div>
</div>
<div class="imcms-field">
<div class="imcms-text-box">
<label for="password" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/10"/></label>
<input id="password" type="password" name="password" class="imcms-input imcms-text-box__input"
maxlength="50" placeholder="<fmt:message key="templates/sv/AdminUserResp.htm/11"/>"
maxlength="250" placeholder="<fmt:message key="templates/sv/AdminUserResp.htm/11"/>"
value="<c:out value='${editedUser.password}'/>">
</div>
</div>
Expand All @@ -79,7 +79,7 @@ ${"-->"}
<label for="password2" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/1001"/></label>
<input id="password2" type="password" name="password2" class="imcms-input imcms-text-box__input"
maxlength="50" value="${editedUser.password}">
maxlength="250" value="${editedUser.password}">
</div>
</div>
<div class="imcms-field">
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/passwordreset/password_reset_form.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
</td>
<td width="50%" style="padding: 0 10px;"><input type="password"
name="<%=PasswordReset.REQUEST_PARAM_PASSWORD%>"
maxlength="50"
maxlength="250"
style="width:100%;"></td>
</tr>
<tr>
<td style="white-space:nowrap;"><%=formLabelPasswordCheck.toLocalizedString(request)%>
</td>
<td style="padding: 0 10px;"><input type="password"
name="<%=PasswordReset.REQUEST_PARAM_PASSWORD_CHECK%>"
maxlength="50"
maxlength="250"
style="width:100%;"></td>
</tr>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ define(

function buildUsersNameFilter() {
const $usersNameFilterBox = components.texts.textBox('<div>', texts.searchFilter.byName);
$usersNameFilter = $usersNameFilterBox.$input.attr("maxLength", 50);
$usersNameFilter = $usersNameFilterBox.$input.attr("maxLength", 250);
return $usersNameFilterBox;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ define('imcms-document-editor-builder',
}
incrementDocumentNumber(documentList.length);
$documentsList.empty();
pushDocumentsInArray(documentList);
documentList.forEach(document => {
$documentsList.append(buildDocument(document, currentEditorOptions, false));
});
Expand Down Expand Up @@ -1303,9 +1304,9 @@ define('imcms-document-editor-builder',
let docs = [];

function pushDocumentsInArray(documentList) {
const allDocIds = docs.map(doc => doc.documentId);
const allDocIds = docs.map(doc => doc.documentId || doc.id);
documentList.forEach(document => {
if (!allDocIds.includes(document.documentId)) {
if (!allDocIds.includes(document.documentId || document.id)) {
docs.push(document);
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/imcms/jsp/usereditor.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@
<label for="login-name" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/8"/></label>
<input id="login-name" type="text" name="login_name" class="imcms-input imcms-text-box__input"
maxlength="50" value="<c:out value='${editedUser.loginName}'/>">
maxlength="250" value="<c:out value='${editedUser.loginName}'/>">
</div>
</div>
<div class="imcms-field">
<div class="imcms-text-box">
<label for="password1" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/10"/></label>
<input id="password1" type="password" name="password1" class="imcms-input imcms-text-box__input"
maxlength="50" placeholder="<fmt:message key="templates/sv/AdminUserResp.htm/11"/>">
maxlength="250" placeholder="<fmt:message key="templates/sv/AdminUserResp.htm/11"/>">
</div>
</div>
<div class="imcms-field">
<div class="imcms-text-box">
<label for="password2" class="imcms-label imcms-text-box__label"><fmt:message
key="templates/sv/AdminUserResp.htm/1001"/></label>
<input id="password2" type="password" name="password2" class="imcms-input imcms-text-box__input"
maxlength="50">
maxlength="250">
</div>
</div>
<div class="imcms-field">
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/imcms/lang/jsp/userbrowser.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<td width="70%">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><input type="text" name="<%= UserBrowser.REQUEST_PARAMETER__SEARCH_STRING %>" size="20" maxlength="50" value="<%= StringEscapeUtils.escapeHtml4(userBrowserPage.getSearchString()) %>"></td>
<td><input type="text" name="<%= UserBrowser.REQUEST_PARAMETER__SEARCH_STRING %>" size="20" maxlength="250" value="<%= StringEscapeUtils.escapeHtml4(userBrowserPage.getSearchString()) %>"></td>
<td class="imcmsAdmDim">&nbsp; <? templates/sv/AdminChangeUser.htm/1001 ?></td>
</tr>
</table></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ public void convert_When_QueryIsExist_Expect_SearchBySpecifiedSimpleQuery() {
}

@Test
public void convert_WhenDefaultPageRequestIsSet_Expect_StartEq0AndRowsEq100() {
public void convert_WhenDefaultPageRequestIsSet_Expect_StartEq0AndRowsEqMaxValue() {
final SolrQuery solrQuery = documentSearchQueryConverter.convertToSolrQuery(searchQueryDTO);

assertThat(solrQuery.get(CommonParams.START), is("0"));
assertThat(solrQuery.get(CommonParams.ROWS), is("100"));
assertThat(solrQuery.get(CommonParams.ROWS), is(Integer.MAX_VALUE + ""));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ void validate_With_TooLongPassword1_Expect_Password1IsTooLongTrue() {
final UserFormData userData = new UserFormData();
userData.setPassword(
"--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100"
+ "-------110-------120-----128" + "1"// extra one
); // max is 128, don't know why
+ "-------110-------120-------130-------140-------150-------160-------170-------180-------190"
+ "-------200-------210-------220-------230-------240-------250" + "1"
);
final UserValidationResult validationResult = userValidator.validate(userData);

assertTrue(validationResult.isPassword1TooLong());
Expand Down Expand Up @@ -177,8 +178,9 @@ void validate_With_TooLongPassword2_Expect_Password2IsTooLongTrue() {
final UserFormData userData = new UserFormData();
userData.setPassword2(
"--------10--------20--------30--------40--------50--------60--------70--------80--------90-------100"
+ "-------110-------120-----128" + "1"// extra one
); // max is 128, don't know why
+ "-------110-------120-------130-------140-------150-------160-------170-------180-------190"
+ "-------200-------210-------220-------230-------240-------250" + "1"
);
final UserValidationResult validationResult = userValidator.validate(userData);

assertTrue(validationResult.isPassword2TooLong());
Expand Down

0 comments on commit 8459a68

Please sign in to comment.