You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

24 lines
787 B

import { Req, Res, ReturnValue } from "#/global"
import { UserSchema } from "@/schema"
import { gFail, gSuccess } from "@/util"
import { auth, config, method, route, validate } from "@noderun/hapi-router"
import * as bcrypt from "bcrypt"
/**
* 登录界面
*/
export default class {
@method("GET")
@auth()
async index(request: Req, h: Res): ReturnValue {
const { id } = request.auth.credentials
const User = request.getModel("User")
let result = <any>await User.findOne({ where: { id: id } })
if (result == null) {
return gFail(null, "不存在该用户")
}
result = result.toJSON()
delete result.password
console.log(result);
return h.view("views/user.pug", { userinfo: result })
}
}