diff options
author | techknowlogick <techknowlogick@gitea.io> | 2019-05-12 13:29:07 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-12 13:29:07 -0400 |
commit | 5ffc9656c63ab44224819412c7d23b2881038844 (patch) | |
tree | 859b72df08da714961e7b8e45091db4fbdb58043 /routers/api | |
parent | 3d82367bdc99a98848d4f8b5ce1d61e25fabc551 (diff) | |
download | gitea-5ffc9656c63ab44224819412c7d23b2881038844.tar.gz gitea-5ffc9656c63ab44224819412c7d23b2881038844.zip |
Change drone token name to let users know to use oauth2 (#6912)
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/user/app.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index c090a724b7..8e3b476d36 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -36,6 +36,9 @@ func ListAccessTokens(ctx *context.APIContext) { apiTokens := make([]*api.AccessToken, len(tokens)) for i := range tokens { + if tokens[i].Name == "drone" { + tokens[i].Name = "drone-legacy-use-oauth2-instead" + } apiTokens[i] = &api.AccessToken{ ID: tokens[i].ID, Name: tokens[i].Name, @@ -76,14 +79,18 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption UID: ctx.User.ID, Name: form.Name, } + if t.Name == "drone" { + t.Name = "drone-legacy-use-oauth2-instead" + } if err := models.NewAccessToken(t); err != nil { ctx.Error(500, "NewAccessToken", err) return } ctx.JSON(201, &api.AccessToken{ - Name: t.Name, - Token: t.Token, - ID: t.ID, + Name: t.Name, + Token: t.Token, + ID: t.ID, + TokenLastEight: t.TokenLastEight, }) } |