44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package auth
|
|
|
|
import (
|
|
"backend/pkg/library/errs"
|
|
"backend/pkg/member/domain/member"
|
|
"backend/pkg/member/domain/usecase"
|
|
"context"
|
|
|
|
"backend/internal/svc"
|
|
"backend/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type VerifyPasswordResetCodeLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewVerifyPasswordResetCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VerifyPasswordResetCodeLogic {
|
|
return &VerifyPasswordResetCodeLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
// VerifyPasswordResetCode 校驗密碼重設驗證碼(頁面需求,預先檢查看看, 顯示表演用)
|
|
func (l *VerifyPasswordResetCodeLogic) VerifyPasswordResetCode(req *types.VerifyCodeReq) (resp *types.RespOK, err error) {
|
|
// 先驗證,不刪除
|
|
if err := l.svcCtx.AccountUC.CheckRefreshCode(l.ctx, usecase.VerifyRefreshCodeRequest{
|
|
VerifyCode: req.VerifyCode,
|
|
LoginID: req.Identifier,
|
|
CodeType: member.GenerateCodeTypeForgetPassword,
|
|
}); err != nil {
|
|
e := errs.Forbidden("failed to get verify code").Wrap(err)
|
|
|
|
return nil, e
|
|
}
|
|
|
|
return &types.RespOK{}, nil
|
|
}
|