Browse Source

fix: 修复用户删除的bug

SongZihuan 3 years ago
parent
commit
527df2e24f
2 changed files with 4 additions and 5 deletions
  1. 4 4
      app/test.py
  2. 0 1
      core/db.py

+ 4 - 4
app/test.py

@@ -28,8 +28,7 @@ class SearchForm(FlaskForm):
 
 class ResetDeleteForm(AuthForm):
     new_passwd = PasswordField("New Password", description="new password",
-                               validators=[DataRequired(message="Must enter new password"),
-                                           Length(4, 32, "Length: 4 - 32")])
+                               validators=[Length(0, 32, "Length: 0 - 32")])
     submit = SubmitField("Submit")
 
 
@@ -241,9 +240,10 @@ def delete_user():
     if not user.check_passwd(delete_form.passwd.data):
         flash("Passwd error.")
     else:
-        flash("User reset")
-        logout_user()
+        flash("User delete")
         user.delete_user()
+        logout_user()
+        return redirect(url_for("home.index"))
     return redirect(url_for("test.question"))
 
 

+ 0 - 1
core/db.py

@@ -336,7 +336,6 @@ class WordDatabase(DataBase):
         count = 0
         while count == 0:
             if box == 5:
-                print()
                 return None
             box += 1
             count = self.search(columns=["COUNT(DISTINCT word)"], table="Word", where=f"box<={box}")[0][0]