member service method added
This commit is contained in:
parent
569fd06729
commit
37fe2d08d0
|
@ -18,6 +18,7 @@ import (
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
|
|
||||||
jwt "github.com/dgrijalva/jwt-go"
|
jwt "github.com/dgrijalva/jwt-go"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -54,10 +55,12 @@ func init() {
|
||||||
type MemberService struct {
|
type MemberService struct {
|
||||||
cda.TypeAnnotation `annotation:"@overflow:RESTService()"`
|
cda.TypeAnnotation `annotation:"@overflow:RESTService()"`
|
||||||
|
|
||||||
_Signin cda.MethodAnnotation `annotation:"@overflow:RequestMapping(method='POST', entry='/account/signin', params='[signinID, signinPW]')"`
|
_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]')"`
|
_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]')"`
|
_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]')"`
|
_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 {
|
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
|
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
|
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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user