forked from mrlan/EnglishPal
Compare commits
1 Commits
master
...
bug359-zha
Author | SHA1 | Date |
---|---|---|
keli_Chuang | 40c86b2050 |
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
from WordFreq import WordFreq
|
||||
from wordfreqCMD import youdao_link, sort_in_descending_order
|
||||
from UseSqlite import InsertQuery, RecordQuery
|
||||
|
|
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
import hashlib
|
||||
from datetime import datetime
|
||||
from UseSqlite import InsertQuery, RecordQuery
|
||||
|
@ -5,10 +6,6 @@ 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')
|
||||
|
@ -51,8 +48,6 @@ 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(
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
'''
|
||||
Yaml.py
|
||||
配置文件包括:
|
||||
|
|
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
###########################################################################
|
||||
# Copyright 2019 (C) Hui Lan <hui.lan@cantab.net>
|
||||
# Written permission must be obtained from the author for commercial uses.
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -68,7 +68,7 @@ def save_frequency_to_pickle(d, pickle_fname):
|
|||
d2 = {}
|
||||
for k in d:
|
||||
if not k in exclusion_lst and not k.isnumeric() and not len(k) < 2:
|
||||
d2[k] = list(sorted(set(d[k])))
|
||||
d2[k] = list(sorted(d[k])) # 原先这里是d2[k] = list(sorted(set(d[k])))
|
||||
pickle.dump(d2, f)
|
||||
f.close()
|
||||
|
||||
|
|
Binary file not shown.
|
@ -29,10 +29,9 @@ 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] != "" && "<mark>".indexOf(list[i]) == -1 && "</mark>".indexOf(list[i]) == -1) {
|
||||
|
||||
txt = txt.replace(new RegExp("\\s"+list[i]+"\\s", "g"), " <mark>" + list[i] + "</mark> ");
|
||||
txt = txt.replace(new RegExp(list[i], "g"), "<mark>" + list[i] + "</mark>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +40,7 @@ function highLight() {
|
|||
for (var i = 0; i < list2.length; ++i) {
|
||||
list2[i] = list2[i].replace(/(^\s*)|(\s*$)/g, "");
|
||||
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>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- coding: UTF-8 -*-
|
||||
###########################################################################
|
||||
# Copyright 2019 (C) Hui Lan <hui.lan@cantab.net>
|
||||
# Written permission must be obtained from the author for commercial uses.
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue