Kaynağa Gözat

fix: 修复表单验证的错误

SongZihuan 2 yıl önce
ebeveyn
işleme
76f6f3edee

+ 1 - 1
templates/archive/archive.html

@@ -13,7 +13,7 @@
             <div class="row">
                 <section class="col-12 col-lg-6 offset-lg-3 text-end">
                     <div class="create">
-                        <form action="{{ url_for('archive.create_archive_page') }}" method="post">
+                        <form action="{{ url_for('archive.create_archive_page') }}" method="post" class="was-validated">
                             {{ form.hidden_tag() }}
                             <div class="text-start">
                                 {{ macro.render_field(form.name) }}

+ 1 - 1
templates/auth/delete.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
         <div class="row">
             <div class="col-12 col-lg-6 offset-lg-3">
-                <form method="post" action="{{ url_for("auth.delete_user_page") }}" class="delete-form">
+                <form method="post" action="{{ url_for("auth.delete_user_page") }}" class="delete-form was-validated">
                     {{ DeleteUserForm.hidden_tag() }}
                     {{ macro.render_field(DeleteUserForm.email) }}
 

+ 1 - 1
templates/auth/login.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
     <div class="row">
         <div class="col-12 col-lg-6 offset-lg-3">
-            <form method="post" action="{{ url_for("auth.login_page") }}" class="login-form">
+            <form method="post" action="{{ url_for("auth.login_page") }}" class="login-form was-validated">
                 {{ form.hidden_tag() }}
                 {{ macro.render_field(form.email) }}
                 {{ macro.render_field(form.passwd) }}

+ 1 - 1
templates/auth/passwd.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
     <div class="row">
         <div class="col-12 col-lg-6 offset-lg-3">
-            <form method="post" action="{{ url_for("auth.change_passwd_page") }}" class="passwd-form">
+            <form method="post" action="{{ url_for("auth.change_passwd_page") }}" class="passwd-form was-validated">
                 {{ ChangePasswdForm.hidden_tag() }}
                 {{ macro.render_field(ChangePasswdForm.old_passwd) }}
                 {{ macro.render_field(ChangePasswdForm.passwd) }}

+ 1 - 1
templates/auth/register.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
     <div class="row">
         <div class="col-12 col-lg-6 offset-lg-3">
-            <form method="post" action="{{ url_for("auth.register_page") }}" class="register-form">
+            <form method="post" action="{{ url_for("auth.register_page") }}" class="register-form was-validated">
                 {{ RegisterForm.hidden_tag() }}
                 {{ macro.render_field(RegisterForm.email) }}
                 {{ macro.render_field(RegisterForm.passwd) }}

+ 3 - 3
templates/auth/role.html

@@ -26,7 +26,7 @@
                 <div id="RoleTabDiv">
                     <div id="RoleTabContent" class="tab-content">
                         <div class="tab-pane fade show active" id="create">
-                            <form method="post" action="{{ url_for('auth.role_create_page') }}" class="role-form">
+                            <form method="post" action="{{ url_for('auth.role_create_page') }}" class="role-form was-validated">
                                 {{ CreateRoleForm.hidden_tag() }}
                                 {{ macro.render_field(CreateRoleForm.name) }}
                                 {{ macro.render_field(CreateRoleForm.authority) }}
@@ -57,7 +57,7 @@
                         </div>
 
                         <div class="tab-pane fade" id="drop">
-                            <form method="post" action="{{ url_for('auth.role_delete_page') }}" class="role-form">
+                            <form method="post" action="{{ url_for('auth.role_delete_page') }}" class="role-form was-validated">
                                 {{ DeleteRoleForm.hidden_tag() }}
                                 {{ macro.render_field(DeleteRoleForm.name) }}
 
@@ -87,7 +87,7 @@
                         </div>
 
                         <div class="tab-pane fade" id="set">
-                            <form method="post" action="{{ url_for('auth.role_set_page') }}" class="role-form">
+                            <form method="post" action="{{ url_for('auth.role_set_page') }}" class="role-form was-validated">
                                 {{ SetRoleForm.hidden_tag() }}
                                 {{ macro.render_field(SetRoleForm.email) }}
                                 {{ macro.render_field(SetRoleForm.name) }}

+ 3 - 3
templates/docx/article.html

@@ -22,7 +22,7 @@
                     <a href="{{ url_for('docx.article_down_page', blog=article.id) }}"> 下载 </a>
                     <hr>
 
-                    <form method="post" action="{{ url_for('docx.update_docx_page') }}">
+                    <form method="post" action="{{ url_for('docx.update_docx_page') }}" class="was-validated">
                         {% if can_update %}
                             {{ view.hidden_tag() }}
                             {{ view.blog_id() }}
@@ -60,7 +60,7 @@
                                         <div class="modal-header">
                                             <h4 class="modal-title"> 更新博客归档信息? </h4>
                                         </div>
-                                        <form method="post">
+                                        <form method="post" class="was-validated">
                                             <div class="modal-body">
                                                 {{ archive.hidden_tag() }}
                                                 {{ archive.blog_id() }}
@@ -98,7 +98,7 @@
                     <h1 class="mt-3"> 评论 </h1>
 
                     <section class="col-12 text-end">
-                        <form action="{{ url_for('docx.comment_page', blog=article.id) }}" method="post">
+                        <form action="{{ url_for('docx.comment_page', blog=article.id) }}" method="post" class="was-validated">
                             {{ form.hidden_tag() }}
                             <div>
                                 {{ form.content(class="form-control mb-2", rows="3") }}

+ 1 - 1
templates/docx/docx.html

@@ -16,7 +16,7 @@
             <div class="row">
                 <div class="col-12">
                     <div class="markdown">
-                        <form action="{{ url_for('docx.create_docx_page', page=page) }}" method="post">
+                        <form action="{{ url_for('docx.create_docx_page', page=page) }}" method="post" class="was-validated">
                             {{ form.hidden_tag() }}
                             {{ macro.render_field(form.title) }}
                             {{ macro.render_field(form.subtitle) }}

+ 1 - 1
templates/index/hello.html

@@ -19,7 +19,7 @@
 {% block content %}
     <section id="title-section">
         <h1 id="title-1"> 欢迎,这里是《{{ blog_name }}》 </h1>
-        <form method="get" action=" {{ url_for('base.index_page') }} ">
+        <form method="get" action=" {{ url_for('base.index_page') }} " class="was-validated">
             <input id="btn" type="submit" value="进入">
         </form>
     </section>

+ 1 - 1
templates/msg/msg.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
         <div class="row">
             <section class="col-12 text-end">
-                <form class="writer clearfix" action="{{ url_for('msg.write_msg_page', page=page) }}" method="post">
+                <form class="writer clearfix was-validated" action="{{ url_for('msg.write_msg_page', page=page) }}" method="post">
                     {{ form.hidden_tag() }}
                     <div>
                         {{ form.content(class="form-control mb-2", rows="5") }}

+ 1 - 1
templates/oss/upload.html

@@ -11,7 +11,7 @@
     <section id="base" class="container mt-3">
     <div class="row">
         <div class="col-12 col-lg-6 offset-lg-3">
-            <form method="post" action="#" class="upload-form" enctype="multipart/form-data">
+            <form method="post" action="#" class="upload-form was-validated" enctype="multipart/form-data">
                 {{ UploadForm.hidden_tag() }}
                 {{ macro.render_field(UploadForm.path) }}