Commit 50f8499f authored by Liang Ding's avatar Liang Ding

💚 #12641

parent d2bcc640
......@@ -28,19 +28,19 @@ import org.testng.annotations.Test;
* {@link IndexProcessor} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.2, Jan 24, 2019
* @version 1.0.1.3, Feb 7, 2019
* @since 1.7.0
*/
@Test(suiteName = "processor")
public class IndexProcessorTestCase extends AbstractTestCase {
/**
* showInit.
* showStart.
*/
@Test
public void showInit() {
public void showStart() {
final MockHttpServletRequest request = mockRequest();
request.setRequestURI("/init");
request.setRequestURI("/start");
final MockHttpServletResponse response = mockResponse();
mockDispatcherServletService(request, response);
......@@ -85,18 +85,4 @@ public class IndexProcessorTestCase extends AbstractTestCase {
final String content = response.body();
Assert.assertTrue(StringUtils.contains(content, "<title>Admin 的个人博客 - 403 Forbidden!</title>"));
}
/**
* showRegister.
*/
@Test(dependsOnMethods = "init")
public void showRegister() {
final MockHttpServletRequest request = mockRequest();
request.setRequestURI("/register");
final MockHttpServletResponse response = mockResponse();
mockDispatcherServletService(request, response);
final String content = response.body();
Assert.assertTrue(StringUtils.contains(content, "<title>Admin 的个人博客 - 注册 Solo 用户!</title>"));
}
}
......@@ -30,8 +30,6 @@ ${addUserLabel}
<input id="userEmail" type="text"/>
<label for="userURL">${userURL1Label}</label>
<input id="userURL" type="text"/>
<label for="userPassword">${userPassword1Label}</label>
<input id="userPassword" type="password" autocomplete="new-password"/>
<label for="userAvatar">${userAvatar1Label}</label>
<input id="userAvatar" type="text"/><br><br>
<button onclick="admin.userList.add();" class="right">${saveLabel}</button>
......@@ -44,8 +42,6 @@ ${addUserLabel}
<input id="userEmailUpdate" type="text"/>
<label for="userURLUpdate">${userURL1Label}</label>
<input id="userURLUpdate" type="text"/>
<label for="userPasswordUpdate">${userPassword1Label}</label>
<input id="userPasswordUpdate" type="password"/>
<label for="userAvatarUpdate">${userAvatar1Label}</label>
<input id="userAvatarUpdate" type="text"/> <br><br>
<button onclick="admin.userList.update();" class="right">${updateLabel}</button>
......
......@@ -23,13 +23,17 @@
<h2>
${articleTitle}
</h2>
<#if msg??>
<div>${msg}</div>
</#if>
<br><br><br>
<form class="form" method="POST" action="${servePath}/console/article-pwd">
<label for="pwdTyped">访问密码</label>
<label for="pwdTyped">访问密码</label>
<input type="password" id="pwdTyped" name="pwdTyped" />
<input type="hidden" name="articleId" value="${articleId}" />
<button id="confirm" type="submit">${confirmLabel}</button>
<div style="text-align: right">
<#if msg??>
<span class="error">${msg}</span>
</#if>
<button id="confirm" type="submit">${confirmLabel}</button>
</div>
</form>
<br><br><br>
</@commonPage>
\ No newline at end of file
......@@ -22,8 +22,10 @@
<@commonPage "403 Forbidden!">
${killBrowserLabel}
<br/>
&nbsp; &nbsp;&nbsp; <button onclick="closeIframe();">${closeLabel}</button> &nbsp; &nbsp;
<button onclick="closeIframeForever();">${closeForeverLabel}</button>
<div style="text-align: right">
<button onclick="closeIframe();">${closeLabel}</button> &nbsp;
<button onclick="closeIframeForever();">${closeForeverLabel}</button>
</div>
<img src='${staticServePath}/images/kill-browser.png' title='Kill IE6' style="float: right;
margin: -171px 0 0 0;" alt='Kill IE6'/>
<script>
......
#
# Solo - A small and beautiful blogging system written in Java.
# Copyright (c) 2010-2019, b3log.org & hacpai.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
#
# Description: Solo local environment configurations for test.
# Version: 1.1.3.12, Oct 8, 2018
# Author: Liang Ding
#
#### H2 runtime ####
runtimeDatabase=H2
jdbc.username=root
jdbc.password=
jdbc.driver=org.h2.Driver
jdbc.URL=jdbc:h2:~/solo_h2/db
# The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt=5
jdbc.maxConnCnt=10
# Be care to change the transaction isolation
jdbc.transactionIsolation=REPEATABLE_READ
# The specific table name prefix
jdbc.tablePrefix=b3_solo
<#--
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-2019, b3log.org & hacpai.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<#include "macro-common-page.ftl">
<@commonPage "${loginLabel}">
<h2>
${loginLabel}
</h2>
<div id="github">
<div class="github__icon"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">
<img src="${staticServePath}/images/github-init.gif"/>
</div>
<button class="hover" onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
<br>
</div>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript">
$('.wrap').css('padding', ($(window).height() - 450) / 2 + 'px 0')
</script>
</@commonPage>
\ No newline at end of file
......@@ -33,21 +33,22 @@
</head>
<body>
<div class="wrap">
<div class="content">
<div class="logo">
<a href="https://b3log.org" target="_blank">
<img width="128" border="0" alt="Solo" title="Solo" src="${staticServePath}/images/logo.png"/>
</a>
<div class="content-wrap">
<div class="content">
<div class="logo">
<a href="https://b3log.org" target="_blank">
<img width="128" border="0" alt="Solo" title="Solo" src="${staticServePath}/images/logo.png"/>
</a>
</div>
<div class="main">
<#nested>
</div>
</div>
<div class="main">
<#nested >
</div>
<span class="clear"></span>
</div>
</div>
<div class="footerWrapper">
<div class="footer">
Powered by <a href="https://b3log.org" target="_blank">B3log 开源</a><a href="https://hacpai.com/tag/solo" target="_blank">Solo</a> ${version}
<div class="footerWrapper">
<div class="footer">
Powered by <a href="https://b3log.org" target="_blank">B3log 开源</a><a href="https://hacpai.com/tag/solo" target="_blank">Solo</a> ${version}
</div>
</div>
</div>
</body>
......
This diff is collapsed.
<#--
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-2019, b3log.org & hacpai.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<#include "macro-common-page.ftl">
<@commonPage "${registerSoloUserLabel}!">
<h2>${registerSoloUserLabel}</h2>
<div id="github">
<div class="github__icon" href="${servePath}/oauth/github/redirect"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">
<img src="${staticServePath}/images/github-init.gif"/>
</div>
<button class="hover"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
<br>
</div>
<div class="form none">
<label for="userEmail">
${commentEmail1Label}
</label>
<input id="userEmail" />
<label for="userName">
${userName1Label}
</label>
<input id="userName" />
<label for="userURL">
${userURL1Label}
</label>
<input id="userURL" />
<label for="userPassword">
${userPassword1Label}
</label>
<input type="password" id="userPassword" />
<label for="userPasswordConfirm">
${userPasswordConfirm1Label}
</label>
<input type="password" id="userPasswordConfirm" />
<button onclick='getUserInfo();'>${registerSoloUserLabel}</button>
<span id="tip" ></span>
</div>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript">
var validate = function() {
var userName = $("#userName").val().replace(/(^\s*)|(\s*$)/g, "");
if (!/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#userEmail").val())) {
$("#tip").text("${mailInvalidLabel}");
$("#userEmail").focus();
} else if (2 > userName.length || userName.length > 20) {
$("#tip").text("${nameTooLongLabel}");
$("#userName").focus();
} else if ($("#userPassword").val() === "") {
$("#tip").text("${passwordEmptyLabel}");
$("#userPassword").focus();
} else if ($("#userPassword").val() !== $("#userPasswordConfirm").val()) {
$("#tip").text("${passwordNotMatchLabel}");
$("#userPasswordConfirm").focus();
} else {
$("#tip").text("");
return true;
}
return false;
};
var getUserInfo = function() {
if (validate()) {
var requestJSONObject = {
"userName": $("#userName").val(),
"userEmail": $("#userEmail").val(),
"userURL": $("#userURL").val(),
"userPassword": $("#userPassword").val()
};
$("#tip").html("<img src='${staticServePath}/images/loading.gif'/> loading...")
$.ajax({
url: "${servePath}" + "/console/user/",
type: "POST",
cache: false,
data: JSON.stringify(requestJSONObject),
success: function(result, textStatus) {
$("#tip").text(result.msg);
if (!result.sc) {
return;
}
setTimeout(function() {
window.location.href = "${servePath}";
}, 1000);
}
})
}
}
$(function() {
$("#userPasswordConfirm").keypress(function(event) {
if (event.keyCode === 13) {
getUserInfo();
}
});
$('.wrap').css('padding', "40px 0");
});
</script>
</@commonPage>
\ No newline at end of file
......@@ -29,11 +29,11 @@
<link rel="icon" type="image/png" href="${staticServePath}/favicon.png"/>
<link rel="apple-touch-icon" href="${staticServePath}/favicon.png">
</head>
<body>
<body class="search__body">
<div class="search__header fn-clear">
<a href="${servePath}"><img class="fn-left" width="44" border="0" alt="Solo" title="Solo" src="${staticServePath}/images/logo.png"/></a>
<div class="search__input fn-left">
<input value="${keyword}" id="keyword" onkeypress="if(event.keyCode===13){document.getElementById('searchBtn').click()}">
<a href="${servePath}"><img width="44" border="0" alt="Solo" title="Solo" src="${staticServePath}/images/logo.png"/></a>
<div class="search__input">
<input value="${keyword}" id="keyword" type="text" onkeypress="if(event.keyCode===13){document.getElementById('searchBtn').click()}">
<button id="searchBtn" onclick="window.location.href='${servePath}/search?keyword=' + document.getElementById('keyword').value">搜索</button>
</div>
<span class="fn-right">
......@@ -41,8 +41,7 @@
<a href="${servePath}/admin-index.do#main">${adminLabel}</a> &nbsp;
<a href="${logoutURL}">${logoutLabel}</a>
<#else>
<a href="${loginURL}">${loginLabel}</a>
&nbsp; <a href="${servePath}/register">${registerLabel}</a>
<a href="${servePath}/start">${startToUseLabel}</a>
</#if>
</span>
</div>
......
......@@ -23,28 +23,25 @@
<h2>
<span>${welcomeToSoloLabel}</span>
<a target="_blank" href="https://b3log.org">
<span class="solo">&nbsp;Solo</span>
<span class="error">&nbsp;Solo</span>
</a>
</h2>
<div id="init">
<div id="github">
<div class="github__icon"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">
<img src="${staticServePath}/images/github-init.gif"/>
</div>
<button class="hover"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
<br>
<div id="github">
<div class="github__icon"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">
<img src="${staticServePath}/images/github.png"/>
</div>
<button class="hover"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
</div>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript">
(function () {
try {
$('.wrap').css('padding', ($(window).height() - 450) / 2 + 'px 0')
$('.wrap')
} catch (e) {
document.querySelector('.main').innerHTML = "${staticErrorLabel}<br><br><br><br><br>"
document.querySelector('.main').innerHTML = "${staticErrorLabel}"
}
})()
</script>
......
......@@ -96,8 +96,7 @@
</#if>
<a href="${logoutURL}" title="${logoutLabel}">${logoutLabel}</a>
<#else>
<a href="${loginURL}" title="${loginLabel}">${loginLabel}</a>
<a href="${servePath}/register" title="${registerLabel}">${registerLabel}</a>
<a href="${servePath}/start" title="${startToUseLabel}">${startToUseLabel}</a>
</#if>
<#if isMobileRequest>
<a href="javascript:void(0)" onclick="Util.switchMobile('mobile');" title="${mobileLabel}">${mobileLabel}</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment