Add Info.

This commit is contained in:
lishuang 2020-06-06 02:49:25 +08:00
parent 4a1e4c1d68
commit 480cbb73ea

View File

@ -37,6 +37,7 @@ func (this *UserController) RegisterRoutes() map[string]func(writer http.Respons
routeMap := make(map[string]func(writer http.ResponseWriter, request *http.Request))
routeMap["/api/user/info"] = this.Wrap(this.Info, USER_ROLE_GUEST)
routeMap["/api/user/login"] = this.Wrap(this.Login, USER_ROLE_GUEST)
routeMap["/api/user/authentication/login"] = this.Wrap(this.AuthenticationLogin, USER_ROLE_GUEST)
routeMap["/api/user/register"] = this.Wrap(this.Register, USER_ROLE_GUEST)
@ -131,6 +132,12 @@ func (this *UserController) AuthenticationLogin(writer http.ResponseWriter, requ
return this.Success(user)
}
//fetch current user's info.
func (this *UserController) Info(writer http.ResponseWriter, request *http.Request) *result.WebResult {
user := this.checkUser(request)
return this.Success(user)
}
//register by username and password. After registering, will auto login.
func (this *UserController) Register(writer http.ResponseWriter, request *http.Request) *result.WebResult {