Compare commits

..

2 Commits

Author SHA1 Message Date
李凯 4817557099 更新 'app/Article.py' 2022-06-11 23:20:41 +08:00
李凯 e40ebac452 更新 'app/static/css/bootstrap.css' 2022-06-11 23:08:29 +08:00
4 changed files with 5 additions and 12 deletions

View File

@ -68,7 +68,7 @@ def get_today_article(user_word_list, articleID):
s += '<div class="p-3 mb-2 bg-light text-dark">' s += '<div class="p-3 mb-2 bg-light text-dark">'
article_title = get_article_title(d['text']) article_title = get_article_title(d['text'])
article_body = get_article_body(d['text']) article_body = get_article_body(d['text'])
s += '<p class="display-3">%s</p>' % (article_title) s += '<p class="display-5">%s</p>' % (article_title)
s += '<p class="lead"><font id="article" size=2>%s</font></p>' % (article_body) s += '<p class="lead"><font id="article" size=2>%s</font></p>' % (article_body)
s += '<p><small class="text-muted">%s</small></p>' % (d['source']) s += '<p><small class="text-muted">%s</small></p>' % (d['source'])
s += '<p><b>%s</b></p>' % (get_question_part(d['question'])) s += '<p><b>%s</b></p>' % (get_question_part(d['question']))

View File

@ -5,10 +5,6 @@ from UseSqlite import InsertQuery, RecordQuery
path_prefix = '/var/www/wordfreq/wordfreq/' path_prefix = '/var/www/wordfreq/wordfreq/'
path_prefix = './' # comment this line in deployment path_prefix = './' # comment this line in deployment
def verify_pass(newpass,oldpass):
if(newpass==oldpass):
return True
def verify_user(username, password): def verify_user(username, password):
rq = RecordQuery(path_prefix + 'static/wordfreqapp.db') rq = RecordQuery(path_prefix + 'static/wordfreqapp.db')
@ -51,8 +47,6 @@ def change_password(username, old_password, new_password):
if not verify_user(username, old_password): # 旧密码错误 if not verify_user(username, old_password): # 旧密码错误
return False return False
# 将用户名和密码一起加密,以免暴露不同用户的相同密码 # 将用户名和密码一起加密,以免暴露不同用户的相同密码
if verify_pass(new_password,old_password): #新旧密码一致
return False
password = md5(username + new_password) password = md5(username + new_password)
rq = InsertQuery(path_prefix + 'static/wordfreqapp.db') rq = InsertQuery(path_prefix + 'static/wordfreqapp.db')
rq.instructions_with_parameters("UPDATE user SET password=:password WHERE name=:username", dict( rq.instructions_with_parameters("UPDATE user SET password=:password WHERE name=:username", dict(

View File

@ -417,7 +417,7 @@ progress {
} }
.lead { .lead {
font-size: 1.25rem; font-size: 2rem;
font-weight: 300 font-weight: 300
} }

View File

@ -29,10 +29,9 @@ function highLight() {
if (sel_word1 != null) { if (sel_word1 != null) {
var list = sel_word1.value.split(" "); var list = sel_word1.value.split(" ");
for (var i = 0; i < list.length; ++i) { 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] != "" && "<mark>".indexOf(list[i]) == -1 && "</mark>".indexOf(list[i]) == -1) { if (list[i] != "" && "<mark>".indexOf(list[i]) == -1 && "</mark>".indexOf(list[i]) == -1) {
txt = txt.replace(new RegExp(list[i], "g"), "<mark>" + list[i] + "</mark>");
txt = txt.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " <mark>" + list[i] + "</mark> ");
} }
} }
} }
@ -41,7 +40,7 @@ function highLight() {
for (var i = 0; i < list2.length; ++i) { for (var i = 0; i < list2.length; ++i) {
list2[i] = list2[i].replace(/(^\s*)|(\s*$)/g, ""); list2[i] = list2[i].replace(/(^\s*)|(\s*$)/g, "");
if (list2[i] != "" && "<mark>".indexOf(list2[i]) == -1 && "</mark>".indexOf(list2[i]) == -1) { if (list2[i] != "" && "<mark>".indexOf(list2[i]) == -1 && "</mark>".indexOf(list2[i]) == -1) {
txt = txt.replace(new RegExp("\\s"+list2[i]+"\\s", "g"), " <mark>" + list2[i] + "</mark> "); txt = txt.replace(new RegExp(list2[i], "g"), "<mark>" + list2[i] + "</mark>");
} }
} }
} }