diff --git a/service/member-service.go b/service/member-service.go index 1e31c00..fa082c3 100644 --- a/service/member-service.go +++ b/service/member-service.go @@ -18,6 +18,7 @@ import ( "github.com/valyala/fasthttp" jwt "github.com/dgrijalva/jwt-go" + "net/url" ) var ( @@ -54,10 +55,12 @@ func init() { type MemberService struct { cda.TypeAnnotation `annotation:"@overflow:RESTService()"` - _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]')"` - _EmailConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/email_confirm', params='[token]')"` + _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, pw]')"` + _EmailConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='GET', entry='/account/email_confirm', params='[token]')"` + _ForgotPassword cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/forgot_password', params='[signinID]')"` + _ResetPwConfirm cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/reset_pw_confirm', params='[pw, key]')"` } func (ms *MemberService) EmailConfirm(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, token string) error { @@ -160,7 +163,43 @@ func (ms *MemberService) SigninByCookie(servletCtx server.ServletCtx, ctx *fasth return nil } -func (ms *MemberService) Signup(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, id string, pw string) error { +func (ms *MemberService) Signup(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, member string, pw string) error { + + gRPCCtx := context.Background() + r, err := grpc.Exec(gRPCCtx, "MemberService.signup", member, pw) + if nil != err { + return err + } + + ctx.SetBody([]byte(r)) return nil } + +func (ms *MemberService) ForgotPassword(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, signinID string) error { + + gRPCCtx := context.Background() + r, err := grpc.Exec(gRPCCtx, "MemberService.sendEmailForPassword", signinID) + if nil != err { + return err + } + + ctx.SetBody([]byte(r)) + + return nil +} + +// Todo id QueryEscape Test +func (ms *MemberService) ResetPwConfirm(servletCtx server.ServletCtx, ctx *fasthttp.RequestCtx, pw string, key string) error { + + gRPCCtx := context.Background() + + r, err := grpc.Exec(gRPCCtx, "MemberService.resetPassword", url.QueryEscape(key), pw) + if nil != err { + return err + } + + ctx.SetBody([]byte(r)) + + return nil +} \ No newline at end of file