Commit dd405ebc authored by Liang Ding's avatar Liang Ding

🎨 升级改造

parent d0498193
......@@ -235,17 +235,19 @@ public class ArticleProcessor {
final String pwdTyped = context.param("pwdTyped");
final JSONObject article = articleQueryService.getArticleById(articleId);
if (article.getString(Article.ARTICLE_VIEW_PWD).equals(pwdTyped)) {
final Session session = request.getSession();
if (null != session) {
Map<String, String> viewPwds = (Map<String, String>) session.getAttribute(Common.ARTICLES_VIEW_PWD);
if (null == viewPwds) {
viewPwds = new HashMap<>();
JSONObject viewPwds;
final String viewPwdsStr = session.getAttribute(Common.ARTICLES_VIEW_PWD);
if (null == viewPwdsStr) {
viewPwds = new JSONObject();
} else {
viewPwds = new JSONObject(viewPwdsStr);
}
viewPwds.put(articleId, pwdTyped);
session.setAttribute(Common.ARTICLES_VIEW_PWD, viewPwds);
session.setAttribute(Common.ARTICLES_VIEW_PWD, viewPwds.toString());
}
context.sendRedirect(Latkes.getServePath() + article.getString(Article.ARTICLE_PERMALINK));
......
......@@ -378,9 +378,12 @@ public final class Solos {
final Session session = request.getSession();
if (null != session) {
Map<String, String> viewPwds = (Map<String, String>) session.getAttribute(Common.ARTICLES_VIEW_PWD);
if (null == viewPwds) {
viewPwds = new HashMap<>();
JSONObject viewPwds;
final String viewPwdsStr = session.getAttribute(Common.ARTICLES_VIEW_PWD);
if (null == viewPwdsStr) {
viewPwds = new JSONObject();
} else {
viewPwds = new JSONObject(viewPwdsStr);
}
if (articleViewPwd.equals(viewPwds.get(article.optString(Keys.OBJECT_ID)))) {
......
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