ing
This commit is contained in:
parent
9f9d1e64e4
commit
7f1e4cb8c0
|
@ -13,10 +13,12 @@ import (
|
||||||
"git.loafle.net/commons/logging-go"
|
"git.loafle.net/commons/logging-go"
|
||||||
"git.loafle.net/commons/server-go"
|
"git.loafle.net/commons/server-go"
|
||||||
_ "git.loafle.net/overflow/commons-go/core/annotation"
|
_ "git.loafle.net/overflow/commons-go/core/annotation"
|
||||||
|
ccm "git.loafle.net/overflow/commons-go/config/member"
|
||||||
"git.loafle.net/overflow/gateway/external/grpc"
|
"git.loafle.net/overflow/gateway/external/grpc"
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
|
||||||
"github.com/dgrijalva/jwt-go"
|
"github.com/dgrijalva/jwt-go"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var MemberServiceType = reflect.TypeOf((*MemberService)(nil))
|
var MemberServiceType = reflect.TypeOf((*MemberService)(nil))
|
||||||
|
@ -38,7 +40,7 @@ type MemberService struct {
|
||||||
_SendEmailPw cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/send_email_pw', params='[signinID]')"`
|
_SendEmailPw cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/send_email_pw', params='[signinID]')"`
|
||||||
_ConfirmResetPw cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/confirm_reset_pw', params='[token]')"`
|
_ConfirmResetPw cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/confirm_reset_pw', params='[token]')"`
|
||||||
|
|
||||||
_ResetPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_password', params='[signinID, newPW]')"`
|
_ResetPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_password', params='[token, pw, confirmPw]')"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SigninResult struct {
|
type SigninResult struct {
|
||||||
|
@ -159,11 +161,14 @@ func (ms *MemberService) SendEmailPw(servletCtx server.ServletCtx, ctx *fasthttp
|
||||||
func (ms *MemberService) ConfirmEmail(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error {
|
func (ms *MemberService) ConfirmEmail(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error {
|
||||||
gRPCCtx := context.Background()
|
gRPCCtx := context.Background()
|
||||||
|
|
||||||
r, err := grpc.Exec(gRPCCtx, "EmailAuthService.readBySignupAuthKey", token)
|
_, err := grpc.Exec(gRPCCtx, "EmailAuthService.readBySignupAuthKey", token)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ctx.SetBody([]byte(r))
|
|
||||||
|
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
|
||||||
|
ctx.Redirect(uri, 302)
|
||||||
|
//ctx.SetBody([]byte(r))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -173,27 +178,35 @@ func (ms *MemberService) ConfirmResetPw(servletCtx server.ServletCtx, ctx *fasth
|
||||||
|
|
||||||
gRPCCtx := context.Background()
|
gRPCCtx := context.Background()
|
||||||
|
|
||||||
r, err := grpc.Exec(gRPCCtx, "EmailAuthService.readByPwAuthKey", token)
|
_, err := grpc.Exec(gRPCCtx, "EmailAuthService.readByPwAuthKey", token)
|
||||||
|
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo Redirect Member_WEBAPP
|
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/modify-password?token=" + token
|
||||||
ctx.SetBody([]byte(r))
|
ctx.Redirect(uri, 302)
|
||||||
|
|
||||||
|
//ctx.SetBody([]byte(r))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ms *MemberService) ResetPassword(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, signinID string, newPw string) error {
|
func (ms *MemberService) ResetPassword(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string, pw string, confirmPw string) error {
|
||||||
|
|
||||||
gRPCCtx := context.Background()
|
gRPCCtx := context.Background()
|
||||||
|
|
||||||
r, err := grpc.Exec(gRPCCtx, "MemberService.resetPassword", signinID, newPw)
|
if strings.Compare(pw, confirmPw) != 0 {
|
||||||
|
return fmt.Errorf("ResetPassword() password not match: %s, %s", pw, confirmPw)
|
||||||
|
}
|
||||||
|
_, err := grpc.Exec(gRPCCtx, "MemberService.resetPassword", token, pw)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.SetBody([]byte(r))
|
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
|
||||||
|
ctx.Redirect(uri, 302)
|
||||||
|
//ctx.SetBody([]byte(r))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user