mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/0.7.0/user-manage' into test
This commit is contained in:
commit
c3fc2fda63
|
@ -198,6 +198,10 @@ func (uc *UserController) UseRePassWord(ctx *gin.Context) {
|
||||||
// @Router /answer/api/v1/user/logout [get]
|
// @Router /answer/api/v1/user/logout [get]
|
||||||
func (uc *UserController) UserLogout(ctx *gin.Context) {
|
func (uc *UserController) UserLogout(ctx *gin.Context) {
|
||||||
accessToken := middleware.ExtractToken(ctx)
|
accessToken := middleware.ExtractToken(ctx)
|
||||||
|
if len(accessToken) == 0 {
|
||||||
|
handler.HandleResponse(ctx, nil, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
_ = uc.authService.RemoveUserCacheInfo(ctx, accessToken)
|
_ = uc.authService.RemoveUserCacheInfo(ctx, accessToken)
|
||||||
handler.HandleResponse(ctx, nil, nil)
|
handler.HandleResponse(ctx, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,10 @@ func InitDB(dataConf *data.Database) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("sync table failed: %s", err)
|
return fmt.Errorf("sync table failed: %s", err)
|
||||||
}
|
}
|
||||||
|
_, err = engine.InsertOne(&entity.Version{ID: 1, VersionNumber: ExpectedVersion()})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("init version table failed: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
err = initAdminUser(engine)
|
err = initAdminUser(engine)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -109,6 +109,7 @@ func (a *AnswerAPIRouter) RegisterMustUnAuthAnswerAPIRouter(r *gin.RouterGroup)
|
||||||
|
|
||||||
func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) {
|
func (a *AnswerAPIRouter) RegisterUnAuthAnswerAPIRouter(r *gin.RouterGroup) {
|
||||||
// user
|
// user
|
||||||
|
r.GET("/user/logout", a.userController.UserLogout)
|
||||||
r.POST("/user/email/change/code", a.userController.UserChangeEmailSendCode)
|
r.POST("/user/email/change/code", a.userController.UserChangeEmailSendCode)
|
||||||
r.POST("/user/email/verification/send", a.userController.UserVerifyEmailSend)
|
r.POST("/user/email/verification/send", a.userController.UserVerifyEmailSend)
|
||||||
r.GET("/personal/user/info", a.userController.GetOtherUserInfoByUsername)
|
r.GET("/personal/user/info", a.userController.GetOtherUserInfoByUsername)
|
||||||
|
@ -196,7 +197,6 @@ func (a *AnswerAPIRouter) RegisterAnswerAPIRouter(r *gin.RouterGroup) {
|
||||||
r.DELETE("/answer", a.answerController.RemoveAnswer)
|
r.DELETE("/answer", a.answerController.RemoveAnswer)
|
||||||
|
|
||||||
// user
|
// user
|
||||||
r.GET("/user/logout", a.userController.UserLogout)
|
|
||||||
r.PUT("/user/password", a.userController.UserModifyPassWord)
|
r.PUT("/user/password", a.userController.UserModifyPassWord)
|
||||||
r.PUT("/user/info", a.userController.UserUpdateInfo)
|
r.PUT("/user/info", a.userController.UserUpdateInfo)
|
||||||
r.PUT("/user/interface", a.userController.UserUpdateInterface)
|
r.PUT("/user/interface", a.userController.UserUpdateInterface)
|
||||||
|
|
Loading…
Reference in New Issue