forked from mrlan/EnglishPal
Merge branch 'Bug502-YuGaoXiang' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230506
commit
becef7e343
|
@ -91,10 +91,7 @@ def article():
|
||||||
question = data.get("question", "")
|
question = data.get("question", "")
|
||||||
level = data.get("level", "4")
|
level = data.get("level", "4")
|
||||||
if content:
|
if content:
|
||||||
try: # check level
|
|
||||||
if level not in ['1', '2', '3', '4']:
|
if level not in ['1', '2', '3', '4']:
|
||||||
raise ValueError
|
|
||||||
except ValueError:
|
|
||||||
return "Level must be between 1 and 4."
|
return "Level must be between 1 and 4."
|
||||||
add_article(content, source, level, question)
|
add_article(content, source, level, question)
|
||||||
_update_context()
|
_update_context()
|
||||||
|
|
|
@ -68,9 +68,9 @@
|
||||||
<script>
|
<script>
|
||||||
// 密码生成器
|
// 密码生成器
|
||||||
function generatePassword(length) {
|
function generatePassword(length) {
|
||||||
var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+~`|}{[]\:;?><,./-=";
|
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^*()_+~`|}{[]\:;?,./-=";
|
||||||
var password = "";
|
let password = "";
|
||||||
for (var i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
password += charset.charAt(Math.floor(Math.random() * charset.length));
|
password += charset.charAt(Math.floor(Math.random() * charset.length));
|
||||||
}
|
}
|
||||||
return password;
|
return password;
|
||||||
|
|
Loading…
Reference in New Issue