rest
This commit is contained in:
parent
4f60a512ab
commit
045a75c3c9
2
main.go
2
main.go
|
@ -25,7 +25,7 @@ func main() {
|
|||
InitCapacity: 2,
|
||||
MaxCapacity: 4,
|
||||
Dial: func() (*grpc.ClientConn, error) {
|
||||
return grpc.Dial("192.168.1.103:13234", grpc.WithInsecure())
|
||||
return grpc.Dial("192.168.1.103:50006", grpc.WithInsecure())
|
||||
},
|
||||
NewClient: func(conn *grpc.ClientConn) (interface{}, error) {
|
||||
return grpcAPI.NewOverflowApiServerClient(conn), nil
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/valyala/fasthttp"
|
||||
"git.loafle.net/overflow/overflow_server_app/backend"
|
||||
"encoding/json"
|
||||
"log"
|
||||
)
|
||||
|
||||
func ForgotPassword(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
||||
|
@ -24,29 +25,33 @@ func ForgotPassword(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
|||
|
||||
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
|
||||
|
||||
//signinId := ctx.QueryArgs().Peek("signinId")
|
||||
//signinId := string(ctx.FormValue("signinId"))
|
||||
//tt := ctx.PostArgs().Peek("signinId")
|
||||
//fmt.Println(string(tt))
|
||||
var ss []interface{}
|
||||
|
||||
signinId := ctx.PostBody()
|
||||
fmt.Println(string(signinId))
|
||||
fmt.Println(signinId)
|
||||
data := make(map[string]interface{})
|
||||
err = json.Unmarshal(signinId, &data)
|
||||
|
||||
//data := make(map[string]interface{})
|
||||
|
||||
err = json.Unmarshal(signinId, &ss)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintf(ctx, "Err!!!!: %s\n", err)
|
||||
}
|
||||
params := []string{data["signinId"].(string)}
|
||||
|
||||
length := len(ss)
|
||||
|
||||
if length < 0{
|
||||
fmt.Println("eeee")
|
||||
}
|
||||
|
||||
dd := ss[0].(map[string]interface{})
|
||||
|
||||
params := []string{dd["signinId"].(string)}
|
||||
|
||||
fmt.Println(params)
|
||||
r, err := c.Exec("MemberService", "sendEmailForPassword", params)
|
||||
|
||||
jData,_ := json.Marshal(r)
|
||||
fmt.Println(r)
|
||||
ctx.Response.Header.Set("Content-Type", "application/json")
|
||||
ctx.Write(jData)
|
||||
//gg, err := ctx.Response.BodyWriter().Write(jData)
|
||||
//fmt.Println(gg)
|
||||
fmt.Println(err)
|
||||
|
||||
fmt.Fprintf(ctx, "Confirm Email!!!!: %s\n", r)
|
||||
ctx.SetContentType("application/javascript")
|
||||
log.Printf("M:%s", r)
|
||||
ctx.SetBody([]byte(r))
|
||||
}
|
||||
|
|
|
@ -5,8 +5,14 @@ import (
|
|||
"git.loafle.net/overflow/overflow_server_app/server"
|
||||
"git.loafle.net/overflow/overflow_server_app/backend"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"net/url"
|
||||
"log"
|
||||
)
|
||||
|
||||
// dZQgXM1o%2FCx48X8DM%2B6ec%2FoPfqA2l%2FLdWtijOZ2EnWk%3D
|
||||
// dZQgXM1o%252FCx48X8DM%252B6ec%252FoPfqA2l%252FLdWtijOZ2EnWk%253D
|
||||
func ResetPassword(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
||||
//msg := sctx.Value("key1")
|
||||
//
|
||||
|
@ -21,12 +27,38 @@ func ResetPassword(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
|||
|
||||
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
|
||||
|
||||
signinId := string(ctx.FormValue("signinId"))
|
||||
signinPw := string(ctx.FormValue("signinPw"))
|
||||
//signinId := string(ctx.FormValue("signinId"))
|
||||
//signinPw := string(ctx.FormValue("signinPw"))
|
||||
|
||||
params := []string{signinId, signinPw}
|
||||
var webParams []interface{}
|
||||
webBytes := ctx.PostBody()
|
||||
err = json.Unmarshal(webBytes, &webParams)
|
||||
|
||||
r, err := c.Exec("MemberService", "resetPassword", params)
|
||||
if err != nil {
|
||||
fmt.Fprintf(ctx, "Err!!!!: %s\n", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(ctx, "Complete Reset Password!!!!: %s\n", r)
|
||||
length := len(webParams)
|
||||
|
||||
if length < 0{
|
||||
fmt.Println("eeee")
|
||||
}
|
||||
|
||||
jsonMap := webParams[0].(map[string]interface{})
|
||||
pw := jsonMap["pw"].(string)
|
||||
key := jsonMap["key"].(string)
|
||||
|
||||
keys := strings.Split(key, "=")
|
||||
|
||||
fmt.Println(pw)
|
||||
fmt.Println("No Escape", keys[1])
|
||||
fmt.Println("queryEscape", url.QueryEscape(keys[1]))
|
||||
|
||||
grpcParams := []string{keys[1], pw }
|
||||
|
||||
r, err := c.Exec("MemberService", "resetPassword", grpcParams)
|
||||
|
||||
ctx.SetContentType("application/javascript")
|
||||
log.Printf("M:%s", r)
|
||||
ctx.SetBody([]byte(r))
|
||||
}
|
|
@ -8,6 +8,8 @@ import (
|
|||
"git.loafle.net/overflow/overflow_server_app/server"
|
||||
|
||||
"github.com/valyala/fasthttp"
|
||||
"encoding/json"
|
||||
"log"
|
||||
)
|
||||
|
||||
func SignIn(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
||||
|
@ -21,13 +23,35 @@ func SignIn(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
|||
|
||||
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
|
||||
|
||||
signinId := string(ctx.FormValue("signinId"))
|
||||
signinPw := string(ctx.FormValue("signinPw"))
|
||||
//signinId := string(ctx.FormValue("signinId"))
|
||||
//signinPw := string(ctx.FormValue("signinPw"))
|
||||
|
||||
var webParams []interface{}
|
||||
webBytes := ctx.PostBody()
|
||||
err = json.Unmarshal(webBytes, &webParams)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintf(ctx, "Err!!!!: %s\n", err)
|
||||
}
|
||||
|
||||
length := len(webParams)
|
||||
|
||||
if length < 0{
|
||||
fmt.Println("eeee")
|
||||
}
|
||||
|
||||
jsonMap := webParams[0].(map[string]interface{})
|
||||
signinId := jsonMap["signinId"].(string)
|
||||
signinPw := jsonMap["signinPw"].(string)
|
||||
|
||||
|
||||
params := []string{signinId, signinPw}
|
||||
|
||||
r, err := c.Exec("MemberService", "signin", params)
|
||||
|
||||
fmt.Fprintf(ctx, "Welcome!!!!: %s\n", r)
|
||||
//fmt.Fprintf(ctx, "Welcome!!!!: %s\n", r)
|
||||
ctx.SetContentType("application/javascript")
|
||||
log.Printf("M:%s", r)
|
||||
ctx.SetBody([]byte(r))
|
||||
|
||||
}
|
||||
|
|
|
@ -27,12 +27,31 @@ func SignUp(sctx *server.ServerContext, ctx *fasthttp.RequestCtx) {
|
|||
}
|
||||
defer c.Close()
|
||||
|
||||
fmt.Fprintf(ctx, "avail: %d\n", grpcPool.Available())
|
||||
|
||||
var webParams []interface{}
|
||||
webBytes := ctx.PostBody()
|
||||
err = json.Unmarshal(webBytes, &webParams)
|
||||
|
||||
if err != nil {
|
||||
fmt.Fprintf(ctx, "Err!!!!: %s\n", err)
|
||||
}
|
||||
|
||||
length := len(webParams)
|
||||
|
||||
if length < 0 {
|
||||
fmt.Println("eeee")
|
||||
}
|
||||
|
||||
jsonMap := webParams[0].(map[string]interface{})
|
||||
memberMap := jsonMap["member"].(map[string]interface{})
|
||||
|
||||
m := &Member{}
|
||||
m.Email = string(ctx.FormValue("email"))
|
||||
m.Name = string(ctx.FormValue("name"))
|
||||
m.CompanyName = string(ctx.FormValue("companyName"))
|
||||
m.Phone = string(ctx.FormValue("phone"))
|
||||
m.Pw = string(ctx.FormValue("pw"))
|
||||
m.Email = memberMap["email"].(string)
|
||||
m.Name = memberMap["name"].(string)
|
||||
m.CompanyName = memberMap["companyName"].(string)
|
||||
m.Phone = memberMap["phone"].(string)
|
||||
m.Pw = memberMap["pw"].(string)
|
||||
|
||||
mm,_ := json.Marshal(m)
|
||||
params := []string{string(mm), string(m.Pw)}
|
||||
|
|
Loading…
Reference in New Issue
Block a user