Merge branch 'Bug502-YuGaoXiang' of http://121.4.94.30:3000/mrlan/EnglishPal into Alpha-snapshot20230506

Hui Lan 2023-05-07 15:59:35 +08:00
commit becef7e343
2 changed files with 4 additions and 7 deletions

View File

@ -91,10 +91,7 @@ def article():
question = data.get("question", "")
level = data.get("level", "4")
if content:
try: # check level
if level not in ['1', '2', '3', '4']:
raise ValueError
except ValueError:
if level not in ['1', '2', '3', '4']:
return "Level must be between 1 and 4."
add_article(content, source, level, question)
_update_context()

View File

@ -68,9 +68,9 @@
<script>
// 密码生成器
function generatePassword(length) {
var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+~`|}{[]\:;?><,./-=";
var password = "";
for (var i = 0; i < length; i++) {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^*()_+~`|}{[]\:;?,./-=";
let password = "";
for (let i = 0; i < length; i++) {
password += charset.charAt(Math.floor(Math.random() * charset.length));
}
return password;