forgot password

This commit is contained in:
geek 2017-08-31 15:37:28 +09:00
parent 0a9e4639f2
commit 6724e5841b
2 changed files with 19 additions and 5 deletions

23
main.go
View File

@ -47,11 +47,24 @@ func main() {
s.SetContextValue("grpc", grpcPool)
s.Route("POST", "/account/signin", member.SignIn)
s.Route("POST", "/account/signup", member.SignUp)
s.Route("POST", "/account/forgot_password", member.ForgotPassword)
s.Route("POST", "/account/reset_password", member.ResetPassword)
s.Route("GET", "/account/check_email", member.CheckEmail)
s.Route("POST", "/account/signin", CORS(member.SignIn))
s.Route("POST", "/account/signup", CORS(member.SignUp))
s.Route("POST", "/account/forgot_password", CORS(member.ForgotPassword))
s.Route("POST", "/account/reset_password", CORS(member.ResetPassword))
s.Route("GET", "/account/check_email", CORS(member.CheckEmail))
fasthttp.ListenAndServe(":19080", s.Handler)
}
func CORS(next server.RequestHandler) server.RequestHandler {
return server.RequestHandler(func(sctx *server.ServerContext, ctx * fasthttp.RequestCtx) {
ctx.Response.Header.Set("Access-Control-Allow-Credentials", "true" )
ctx.Response.Header.Set("Access-Control-Allow-Headers", "authorization")
ctx.Response.Header.Set("Access-Control-Allow-Methods", "HEAD,GET,POST,PUT,DELETE,OPTIONS" )
ctx.Response.Header.Set("Access-Control-Allow-Origin", "*")
next(sctx, ctx)
})
}

View File

@ -25,6 +25,7 @@ func ForgotPassword(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
signinId := string(ctx.FormValue("signinId"))
fmt.Println(signinId)
params := []string{signinId}
r, err := c.Exec("MemberService", "sendEmailForPassword", params)