This commit is contained in:
geek 2018-06-01 12:49:45 +09:00
parent f27195c47f
commit 8f29e1de86

View File

@ -14,7 +14,6 @@ import (
cdr "git.loafle.net/commons/di-go/registry"
"git.loafle.net/commons/logging-go"
"git.loafle.net/commons/server-go"
ccm "git.loafle.net/overflow/commons-go/config/member"
"git.loafle.net/overflow/external-go/grpc"
"github.com/dgrijalva/jwt-go"
"github.com/valyala/fasthttp"
@ -38,9 +37,9 @@ type MemberService struct {
_Signin cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin', params='[signinID, signinPW]')"`
_SigninByCookie cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin_cookie', params='[authToken]')"`
_Signup cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signup', params='[member, password]')"`
_ConfirmEmail cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/confirm_email', params='[token]')"`
_ConfirmEmail cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/confirm_email', params='[token]')"`
_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='POST', entry='/account/confirm_reset_pw', params='[token]')"`
_ResetPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_password', params='[token, pw, confirmPw]')"`
}
@ -163,33 +162,32 @@ func (ms *MemberService) SendEmailPw(servletCtx server.ServletCtx, ctx *fasthttp
func (ms *MemberService) ConfirmEmail(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error {
gRPCCtx := context.Background()
_, err := grpc.Exec(gRPCCtx, "EmailAuthService.readBySignupAuthKey", token)
r, err := grpc.Exec(gRPCCtx, "EmailAuthService.readBySignupAuthKey", token)
if nil != err {
return err
}
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
ctx.Redirect(uri, 302)
//ctx.SetBody([]byte(r))
//uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
//ctx.Redirect(uri, 302)
ctx.SetBody([]byte(r))
return nil
}
// Todo id QueryEscape Test
func (ms *MemberService) ConfirmResetPw(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error {
gRPCCtx := context.Background()
_, err := grpc.Exec(gRPCCtx, "EmailAuthService.readByPwAuthKey", token)
r, err := grpc.Exec(gRPCCtx, "EmailAuthService.readByPwAuthKey", token)
if nil != err {
return err
}
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/modify-password?token=" + token
ctx.Redirect(uri, 302)
//uri := ccm.NG_MEMBER_SERVER_URI + "/auth/modify-password?token=" + token
//ctx.Redirect(uri, 302)
//ctx.SetBody([]byte(r))
ctx.SetBody([]byte(r))
return nil
}
@ -201,14 +199,14 @@ func (ms *MemberService) ResetPassword(servletCtx server.ServletCtx, ctx *fastht
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)
r, err := grpc.Exec(gRPCCtx, "MemberService.resetPassword", token, pw)
if nil != err {
return err
}
uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
ctx.Redirect(uri, 302)
//ctx.SetBody([]byte(r))
//uri := ccm.NG_MEMBER_SERVER_URI + "/auth/signin"
//ctx.Redirect(uri, 302)
ctx.SetBody([]byte(r))
return nil
}