Skip to content

Commit

Permalink
let client token empty
Browse files Browse the repository at this point in the history
  • Loading branch information
patyhank committed May 1, 2023
1 parent 714b425 commit 10bc13e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ func main() {
})
return
}
if auth, ok := authTemp[payload.UserName]; ok {
profile := Profile{
ID: auth.UUID,
Name: auth.Name,
}
c.JSON(200, authResp{
Tokens: Tokens{
AccessToken: payload.UserName,
ClientToken: "",
},
AvailableProfiles: []Profile{profile},
SelectedProfile: profile,
})
}
auth, err := GMMAuth.GetMCcredentialsByPassword(ac[0], ac[1])
if err != nil {
c.AbortWithStatusJSON(400, gin.H{
Expand All @@ -163,7 +177,7 @@ func main() {
c.JSON(200, authResp{
Tokens: Tokens{
AccessToken: payload.UserName,
ClientToken: payload.UserName,
ClientToken: "",
},
AvailableProfiles: []Profile{profile},
SelectedProfile: profile,
Expand Down Expand Up @@ -218,13 +232,11 @@ func main() {
SelectedProfile: strings.ReplaceAll(authTemp[req.AccessToken].UUID, "-", ""),
ServerID: req.ServerID,
})
if err != nil {
c.AbortWithStatus(403)
if err == nil {
c.Status(204)
log.Printf("[login] Code [%v]: %v\n", req.AccessToken, "Successful(cache)")
return
}
c.Status(204)
log.Printf("[login] Code [%v]: %v\n", req.AccessToken, "Successful(cache)")
return
}
auth, err := GMMAuth.GetMCcredentialsByPassword(ac[0], ac[1])
if err != nil {
Expand Down Expand Up @@ -256,6 +268,7 @@ func main() {
ac := accountsData[user]
auth, err := GMMAuth.GetMCcredentialsByPassword(ac[0], ac[1])
if err != nil {
fmt.Println(err)
c.AbortWithStatus(400)
return
}
Expand Down

0 comments on commit 10bc13e

Please sign in to comment.