Browse Source

fixed bug

dev
npmrun 3 years ago
parent
commit
bd0688dda8
  1. 1
      public/image/icons/error.svg
  2. BIN
      source/db/data.db
  3. 6
      source/route/views/login.ts
  4. 4
      template/helper/flush.pug

1
public/image/icons/error.svg

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1663034594471" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1381" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 0C229.23 0 0 229.23 0 512s229.23 512 512 512 512-229.23 512-512S794.77 0 512 0z m169.71 568.57a80 80 0 0 1-113.14 113.14L512 625.14l-56.57 56.57a80 80 0 1 1-113.14-113.14L398.86 512l-56.57-56.57a80 80 0 1 1 113.14-113.14L512 398.86l56.57-56.57a80 80 0 1 1 113.14 113.14L625.14 512z" p-id="1382" fill="#d81e06"></path></svg>

After

Width:  |  Height:  |  Size: 661 B

BIN
source/db/data.db

Binary file not shown.

6
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 = <any>await User.findOne({ where: { username: username } });

4
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}

Loading…
Cancel
Save