diff --git a/public/image/icons/error.svg b/public/image/icons/error.svg
new file mode 100644
index 0000000..658f161
--- /dev/null
+++ b/public/image/icons/error.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/source/db/data.db b/source/db/data.db
index f5c3720..308def5 100644
Binary files a/source/db/data.db and b/source/db/data.db differ
diff --git a/source/route/views/login.ts b/source/route/views/login.ts
index ac58d31..dc2e978 100644
--- a/source/route/views/login.ts
+++ b/source/route/views/login.ts
@@ -17,7 +17,7 @@ export default class {
} else {
logger.debug("未登录");
}
- return h.view("views/login.pug");
+ return h.view("views/login.pug");
}
@method("POST")
@@ -25,6 +25,10 @@ export default class {
@auth(false)
async loginRes(request: Req, h: Res): ReturnValue {
const { username, password } = request.payload as any;
+ if(!username || !password ){
+ request.yar.flash('error', 'username or password can not be empty.');
+ return h.redirect("/login");
+ }
const User = request.getModel("User");
const account = await User.findOne({ where: { username: username } });
diff --git a/template/helper/flush.pug b/template/helper/flush.pug
index a58db37..2e1ace1 100644
--- a/template/helper/flush.pug
+++ b/template/helper/flush.pug
@@ -4,9 +4,9 @@ if flash&&flash.error
each item in flash.error
.toast.show(role='alert', aria-live='assertive', aria-atomic='true')
.toast-header
- img.rounded.me-2(src='...', alt='错误')
+ img.rounded.me-2(src='/public/image/icons/error.svg', alt='错误' style="width:20px;height: 20px;")
strong.me-auto 提示
- small.text-muted just now
+ //- small.text-muted just now
button.btn-close(type='button', data-bs-dismiss='toast', aria-label='Close')
.toast-body.
#{item}