Skip to content

Commit 5ffc965

Browse files
Change drone token name to let users know to use oauth2 (#6912)
1 parent 3d82367 commit 5ffc965

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

routers/api/v1/user/app.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ func ListAccessTokens(ctx *context.APIContext) {
3636

3737
apiTokens := make([]*api.AccessToken, len(tokens))
3838
for i := range tokens {
39+
if tokens[i].Name == "drone" {
40+
tokens[i].Name = "drone-legacy-use-oauth2-instead"
41+
}
3942
apiTokens[i] = &api.AccessToken{
4043
ID: tokens[i].ID,
4144
Name: tokens[i].Name,
@@ -76,14 +79,18 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption
7679
UID: ctx.User.ID,
7780
Name: form.Name,
7881
}
82+
if t.Name == "drone" {
83+
t.Name = "drone-legacy-use-oauth2-instead"
84+
}
7985
if err := models.NewAccessToken(t); err != nil {
8086
ctx.Error(500, "NewAccessToken", err)
8187
return
8288
}
8389
ctx.JSON(201, &api.AccessToken{
84-
Name: t.Name,
85-
Token: t.Token,
86-
ID: t.ID,
90+
Name: t.Name,
91+
Token: t.Token,
92+
ID: t.ID,
93+
TokenLastEight: t.TokenLastEight,
8794
})
8895
}
8996

0 commit comments

Comments
 (0)