Skip to content

Commit 3175d08

Browse files
daniil-pankratovDaniil Pankratov
and
Daniil Pankratov
authored
CLI support for OAuth sources custom icons (#14166)
Co-authored-by: Daniil Pankratov <[email protected]>
1 parent d75f011 commit 3175d08

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

cmd/admin.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,11 @@ var (
282282
Value: "",
283283
Usage: "Use a custom Email URL (option for GitHub)",
284284
},
285+
cli.StringFlag{
286+
Name: "icon-url",
287+
Value: "",
288+
Usage: "Custom icon URL for OAuth2 login source",
289+
},
285290
}
286291

287292
microcmdAuthUpdateOauth = cli.Command{
@@ -606,6 +611,7 @@ func parseOAuth2Config(c *cli.Context) *models.OAuth2Config {
606611
ClientSecret: c.String("secret"),
607612
OpenIDConnectAutoDiscoveryURL: c.String("auto-discover-url"),
608613
CustomURLMapping: customURLMapping,
614+
IconURL: c.String("icon-url"),
609615
}
610616
}
611617

@@ -658,6 +664,10 @@ func runUpdateOauth(c *cli.Context) error {
658664
oAuth2Config.OpenIDConnectAutoDiscoveryURL = c.String("auto-discover-url")
659665
}
660666

667+
if c.IsSet("icon-url") {
668+
oAuth2Config.IconURL = c.String("icon-url")
669+
}
670+
661671
// update custom URL mapping
662672
var customURLMapping = &oauth2.CustomURLMapping{}
663673

docs/content/doc/usage/command-line.en-us.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Admin operations:
114114
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
115115
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
116116
- `--custom-email-url`: Use a custom Email URL (option for GitHub).
117+
- `--icon-url`: Custom icon URL for OAuth2 login source.
117118
- Examples:
118119
- `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
119120
- `update-oauth`:
@@ -129,6 +130,7 @@ Admin operations:
129130
- `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
130131
- `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
131132
- `--custom-email-url`: Use a custom Email URL (option for GitHub).
133+
- `--icon-url`: Custom icon URL for OAuth2 login source.
132134
- Examples:
133135
- `gitea admin auth update-oauth --id 1 --name external-github-updated`
134136
- `add-ldap`: Add new LDAP (via Bind DN) authentication source
@@ -465,4 +467,4 @@ Restore-repo restore repository data from disk dir:
465467
- `--repo_dir dir`, `-r dir`: Repository dir path to restore from
466468
- `--owner_name lunny`: Restore destination owner name
467469
- `--repo_name tango`: Restore destination repository name
468-
- `--units <units>`: Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.
470+
- `--units <units>`: Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.

0 commit comments

Comments
 (0)