From 260f62967bd997b61fd4389252c552614a1c369d Mon Sep 17 00:00:00 2001 From: miaochenshuo Date: Sun, 5 Jun 2022 23:36:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Bug394?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Login.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Login.py b/app/Login.py index 65047f7..f1317b2 100644 --- a/app/Login.py +++ b/app/Login.py @@ -5,6 +5,10 @@ from UseSqlite import InsertQuery, RecordQuery path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = './' # comment this line in deployment +def verify_pass(newpass,oldpass): + if(newpass==oldpass): + return True + def verify_user(username, password): rq = RecordQuery(path_prefix + 'static/wordfreqapp.db') @@ -47,6 +51,8 @@ def change_password(username, old_password, new_password): if not verify_user(username, old_password): # 旧密码错误 return False # 将用户名和密码一起加密,以免暴露不同用户的相同密码 + if verify_pass(new_password,old_password): #新旧密码一致 + return False password = md5(username + new_password) rq = InsertQuery(path_prefix + 'static/wordfreqapp.db') rq.instructions_with_parameters("UPDATE user SET password=:password WHERE name=:username", dict( From b53e7031e5d1a21d300c8a40821694469e282e66 Mon Sep 17 00:00:00 2001 From: lin <1002171145@qq.com> Date: Mon, 13 Jun 2022 11:40:20 +0800 Subject: [PATCH 2/2] Bug412-JiangLetian --- app/static/js/highlight.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/static/js/highlight.js b/app/static/js/highlight.js index 2e0d84a..d91fb24 100644 --- a/app/static/js/highlight.js +++ b/app/static/js/highlight.js @@ -29,9 +29,10 @@ function highLight() { if (sel_word1 != null) { var list = sel_word1.value.split(" "); for (var i = 0; i < list.length; ++i) { - list[i] = list[i].replace(/(^\s*)|(\s*$)/g, ""); + list[i] = list[i].replace(/(^\s*)|(\s*$)/g, "");//消除字符串两边空字符 if (list[i] != "" && "".indexOf(list[i]) == -1 && "".indexOf(list[i]) == -1) { - txt = txt.replace(new RegExp(list[i], "g"), "" + list[i] + ""); + + txt = txt.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " " + list[i] + " "); } } } @@ -40,7 +41,7 @@ function highLight() { for (var i = 0; i < list2.length; ++i) { list2[i] = list2[i].replace(/(^\s*)|(\s*$)/g, ""); if (list2[i] != "" && "".indexOf(list2[i]) == -1 && "".indexOf(list2[i]) == -1) { - txt = txt.replace(new RegExp(list2[i], "g"), "" + list2[i] + ""); + txt = txt.replace(new RegExp("\\s"+list2[i]+"\\s", "g"), " " + list2[i] + " "); } } }