forked from mrlan/EnglishPal
Compare commits
1 Commits
master
...
Bug393-Tan
Author | SHA1 | Date |
---|---|---|
覃艳美 | 8924166975 |
|
@ -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(
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
isRead = true;
|
||||||
|
isChoose = true;
|
||||||
|
var reader = window.speechSynthesis; // 全局定义朗读者,以便朗读和暂停
|
||||||
|
reader.cancel();// 初始化时清空reader列表
|
||||||
|
function getWord(){
|
||||||
|
var word = window.getSelection?window.getSelection():document.selection.createRange().text;
|
||||||
|
return word;
|
||||||
|
}
|
||||||
|
function fillinWord(){
|
||||||
|
var word = getWord();
|
||||||
|
if (isRead) read(word);
|
||||||
|
if (!isChoose) return;
|
||||||
|
var element = document.getElementById("selected-words");
|
||||||
|
element.value = element.value + " " + word;
|
||||||
|
}
|
||||||
|
document.getElementById("text-content").addEventListener("click", fillinWord, false);
|
||||||
|
function read(s){
|
||||||
|
var msg = new SpeechSynthesisUtterance(s);
|
||||||
|
reader.speak(msg);
|
||||||
|
console.log("+++++++++++++");
|
||||||
|
}
|
||||||
|
|
||||||
|
function onReadClick(){
|
||||||
|
isRead = !isRead;
|
||||||
|
if(!isRead){
|
||||||
|
reader.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onChooseClick(){
|
||||||
|
isChoose = !isChoose;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue