✨ add casbin ent adapter & code migration
This commit is contained in:
@@ -50,6 +50,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
Path: "/reset_password",
|
||||
Handler: user.ResetPasswordHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/token/refresh",
|
||||
Handler: user.RefreshTokenHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithSignature(serverCtx.Config.Signature),
|
||||
|
@@ -19,7 +19,7 @@ func PhoneLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
l := user.NewPhoneLoginLogic(r.Context(), svcCtx)
|
||||
resp, err := l.PhoneLogin(&req)
|
||||
resp, err := l.PhoneLogin(r, w, &req)
|
||||
if err != nil || resp.Code == 500 {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
|
22
app/core/api/internal/handler/user/refresh_token_handler.go
Normal file
22
app/core/api/internal/handler/user/refresh_token_handler.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/logic/user"
|
||||
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
|
||||
)
|
||||
|
||||
func RefreshTokenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := user.NewRefreshTokenLogic(r.Context(), svcCtx)
|
||||
resp, err := l.RefreshToken(r)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user