mirror of
https://github.com/go-gitea/gitea
synced 2024-11-19 00:11:24 +01:00
Change drone token name to let users know to use oauth2 (#6912)
This commit is contained in:
parent
3d82367bdc
commit
5ffc9656c6
1 changed files with 10 additions and 3 deletions
|
@ -36,6 +36,9 @@ func ListAccessTokens(ctx *context.APIContext) {
|
||||||
|
|
||||||
apiTokens := make([]*api.AccessToken, len(tokens))
|
apiTokens := make([]*api.AccessToken, len(tokens))
|
||||||
for i := range tokens {
|
for i := range tokens {
|
||||||
|
if tokens[i].Name == "drone" {
|
||||||
|
tokens[i].Name = "drone-legacy-use-oauth2-instead"
|
||||||
|
}
|
||||||
apiTokens[i] = &api.AccessToken{
|
apiTokens[i] = &api.AccessToken{
|
||||||
ID: tokens[i].ID,
|
ID: tokens[i].ID,
|
||||||
Name: tokens[i].Name,
|
Name: tokens[i].Name,
|
||||||
|
@ -76,6 +79,9 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption
|
||||||
UID: ctx.User.ID,
|
UID: ctx.User.ID,
|
||||||
Name: form.Name,
|
Name: form.Name,
|
||||||
}
|
}
|
||||||
|
if t.Name == "drone" {
|
||||||
|
t.Name = "drone-legacy-use-oauth2-instead"
|
||||||
|
}
|
||||||
if err := models.NewAccessToken(t); err != nil {
|
if err := models.NewAccessToken(t); err != nil {
|
||||||
ctx.Error(500, "NewAccessToken", err)
|
ctx.Error(500, "NewAccessToken", err)
|
||||||
return
|
return
|
||||||
|
@ -84,6 +90,7 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption
|
||||||
Name: t.Name,
|
Name: t.Name,
|
||||||
Token: t.Token,
|
Token: t.Token,
|
||||||
ID: t.ID,
|
ID: t.ID,
|
||||||
|
TokenLastEight: t.TokenLastEight,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue