File tree Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Expand file tree Collapse file tree 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,9 @@ var JwtMiddlewareStruct = jwt.GinJWTMiddleware{
50
50
IdentityHandler : func (c * gin.Context ) interface {} {
51
51
claims := jwt .ExtractClaims (c )
52
52
return & models.JWTTeam {
53
- TeamName : claims [identityKey ].(string ),
53
+ Login : claims [identityKey ].(string ),
54
+ TeamName : claims ["name" ].(string ),
55
+ Address : claims ["address" ].(string ),
54
56
}
55
57
},
56
58
Authenticator : func (c * gin.Context ) (interface {}, error ) {
Original file line number Diff line number Diff line change @@ -13,12 +13,13 @@ type Score struct {
13
13
}
14
14
15
15
type ScoreService struct {
16
- SLA float64 `bson:"sla" json:"sla"`
17
- State int `bson:"state" json:"state"`
18
- Gained int `bson:"gained" json:"gained"`
19
- Lost int `bson:"lost" json:"lost"`
20
- HP int `bson:"hp" json:"hp"`
21
- Cost int `bson:"cost" json:"cost"`
16
+ SLA float64 `bson:"sla" json:"sla"`
17
+ State int `bson:"state" json:"state"`
18
+ Gained int `bson:"gained" json:"gained"`
19
+ Lost int `bson:"lost" json:"lost"`
20
+ HP int `bson:"hp" json:"hp"`
21
+ TotalHP int `bson:"total_hp" json:"total_hp"`
22
+ Cost int `bson:"cost" json:"cost"`
22
23
}
23
24
24
25
type OutputScoreboard struct {
Original file line number Diff line number Diff line change @@ -53,9 +53,7 @@ func DownloadVpnConfig(username string) (string, error) {
53
53
log .Fatal (err )
54
54
}
55
55
56
- vpnConfig := string (responseData )
57
-
58
- return vpnConfig , nil
56
+ return string (responseData ), nil
59
57
}
60
58
61
59
func (vpnRoute * VpnRoute ) WriteTeamsRoutes () error {
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
"log"
13
13
"net"
14
14
"net/http"
15
+ "strings"
15
16
"time"
16
17
)
17
18
@@ -109,11 +110,12 @@ func CreateTeam(c *gin.Context) {
109
110
c .JSON (http .StatusBadRequest , gin.H {"detail" : hashErr .Error ()})
110
111
return
111
112
}
112
-
113
+ login := slug .Make (team .Name )
114
+ login = strings .Replace (login , "-" , "_" , - 1 )
113
115
dbTeam := & models.Team {
114
116
ID : primitive .NewObjectID (),
115
117
Name : team .Name ,
116
- Login : slug . Make ( team . Name ) ,
118
+ Login : login ,
117
119
Address : ipAddress ,
118
120
Hash : hash ,
119
121
SshPubKey : team .SshPubKey ,
@@ -133,6 +135,7 @@ func CreateTeam(c *gin.Context) {
133
135
}
134
136
c .JSON (http .StatusOK , gin.H {
135
137
"message" : fmt .Sprintf ("The team %s created" , team .Name ),
138
+ "login" : login ,
136
139
})
137
140
}
138
141
You can’t perform that action at this time.
0 commit comments