Skip to content

Commit

Permalink
fix: bind account
Browse files Browse the repository at this point in the history
  • Loading branch information
LiusCraft committed Feb 19, 2024
1 parent c3804aa commit 086706c
Show file tree
Hide file tree
Showing 8 changed files with 1,059 additions and 1,410 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ go.work
# gop_autogen.go
dist/
node_modules/
.vscode/
28 changes: 28 additions & 0 deletions cmd/gopcomm/community_yap.gox
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,28 @@ get "/user/:id", ctx => {
"UserId": user.Id,
}
}
get "/userUnlink", ctx => {
pv := ctx.param("pv")
switch pv {
case "Twitter":
case "Facebook":
case "Github":
case "WeChat":
default:
http.Redirect(ctx.ResponseWriter, ctx.Request, "/userEdit", http.StatusTemporaryRedirect)
}
token, err := core.GetToken(ctx)
if err == nil {
http.Redirect(ctx.ResponseWriter, ctx.Request, "/userEdit", http.StatusTemporaryRedirect)
}

if err != nil {
http.Redirect(ctx.ResponseWriter, ctx.Request, "/error", http.StatusTemporaryRedirect)
}

community.UnLink(token.Value, pv)
http.Redirect(ctx.ResponseWriter, ctx.Request, "/userEdit", http.StatusTemporaryRedirect)
}
get "/userEdit", ctx => {
var user *core.User
token, err := core.GetToken(ctx)
Expand All @@ -134,8 +155,15 @@ get "/userEdit", ctx => {
if err != nil {
http.Redirect(ctx.ResponseWriter, ctx.Request, "/error", http.StatusTemporaryRedirect)
}
appInfo, err := community.GetApplicationInfo()
if err != nil {
http.Redirect(ctx.ResponseWriter, ctx.Request, "/error", http.StatusTemporaryRedirect)
}
appInfoStr, _ := json.Marshal(*appInfo)
ctx.yap "user_edit", {
"User": user,
"Application": string(appInfoStr),
"Binds": community.GetAccountBinds(token.Value),
}
}

Expand Down
Loading

0 comments on commit 086706c

Please sign in to comment.