mirror of
https://github.com/thomiceli/opengist.git
synced 2024-12-23 04:52:40 +00:00
Add ability to specify custom names in the OAuth login buttons (#214)
This commit is contained in:
parent
86590d2990
commit
915287dc10
14 changed files with 25 additions and 24 deletions
|
@ -78,12 +78,16 @@ gitlab.client-key:
|
||||||
gitlab.secret:
|
gitlab.secret:
|
||||||
# URL of the Gitlab instance. Default: https://gitlab.com/
|
# URL of the Gitlab instance. Default: https://gitlab.com/
|
||||||
gitlab.url: https://gitlab.com/
|
gitlab.url: https://gitlab.com/
|
||||||
|
# The name of the GitLab instance. It is displayed in the OAuth login button. Default: GitLab
|
||||||
|
gitlab.name: GitLab
|
||||||
|
|
||||||
# To create a new OAuth2 application using Gitea : https://gitea.domain/user/settings/applications
|
# To create a new OAuth2 application using Gitea : https://gitea.domain/user/settings/applications
|
||||||
gitea.client-key:
|
gitea.client-key:
|
||||||
gitea.secret:
|
gitea.secret:
|
||||||
# URL of the Gitea instance. Default: https://gitea.com/
|
# URL of the Gitea instance. Default: https://gitea.com/
|
||||||
gitea.url: https://gitea.com/
|
gitea.url: https://gitea.com/
|
||||||
|
# The name of the Gitea instance. It is displayed in the OAuth login button. Default: Gitea
|
||||||
|
gitea.name: Gitea
|
||||||
|
|
||||||
# To create a new OAuth2 application using OpenID Connect:
|
# To create a new OAuth2 application using OpenID Connect:
|
||||||
oidc.client-key:
|
oidc.client-key:
|
||||||
|
|
|
@ -24,9 +24,11 @@
|
||||||
| gitlab.client-key | OG_GITLAB_CLIENT_KEY | none | The client key for the GitLab OAuth application. |
|
| gitlab.client-key | OG_GITLAB_CLIENT_KEY | none | The client key for the GitLab OAuth application. |
|
||||||
| gitlab.secret | OG_GITLAB_SECRET | none | The secret for the GitLab OAuth application. |
|
| gitlab.secret | OG_GITLAB_SECRET | none | The secret for the GitLab OAuth application. |
|
||||||
| gitlab.url | OG_GITLAB_URL | `https://gitlab.com/` | The URL of the GitLab instance. |
|
| gitlab.url | OG_GITLAB_URL | `https://gitlab.com/` | The URL of the GitLab instance. |
|
||||||
|
| gitlab.name | OG_GITLAB_NAME | `GitLab` | The name of the GitLab instance. It is displayed in the OAuth login button. |
|
||||||
| gitea.client-key | OG_GITEA_CLIENT_KEY | none | The client key for the Gitea OAuth application. |
|
| gitea.client-key | OG_GITEA_CLIENT_KEY | none | The client key for the Gitea OAuth application. |
|
||||||
| gitea.secret | OG_GITEA_SECRET | none | The secret for the Gitea OAuth application. |
|
| gitea.secret | OG_GITEA_SECRET | none | The secret for the Gitea OAuth application. |
|
||||||
| gitea.url | OG_GITEA_URL | `https://gitea.com/` | The URL of the Gitea instance. |
|
| gitea.url | OG_GITEA_URL | `https://gitea.com/` | The URL of the Gitea instance. |
|
||||||
|
| gitea.name | OG_GITEA_NAME | `Gitea` | The name of the Gitea instance. It is displayed in the OAuth login button. |
|
||||||
| oidc.client-key | OG_OIDC_CLIENT_KEY | none | The client key for the OpenID application. |
|
| oidc.client-key | OG_OIDC_CLIENT_KEY | none | The client key for the OpenID application. |
|
||||||
| oidc.secret | OG_OIDC_SECRET | none | The secret for the OpenID application. |
|
| oidc.secret | OG_OIDC_SECRET | none | The secret for the OpenID application. |
|
||||||
| oidc.discovery-url | OG_OIDC_DISCOVERY_URL | none | Discovery endpoint of the OpenID provider. |
|
| oidc.discovery-url | OG_OIDC_DISCOVERY_URL | none | Discovery endpoint of the OpenID provider. |
|
||||||
|
|
|
@ -52,10 +52,12 @@ type config struct {
|
||||||
GitlabClientKey string `yaml:"gitlab.client-key" env:"OG_GITLAB_CLIENT_KEY"`
|
GitlabClientKey string `yaml:"gitlab.client-key" env:"OG_GITLAB_CLIENT_KEY"`
|
||||||
GitlabSecret string `yaml:"gitlab.secret" env:"OG_GITLAB_SECRET"`
|
GitlabSecret string `yaml:"gitlab.secret" env:"OG_GITLAB_SECRET"`
|
||||||
GitlabUrl string `yaml:"gitlab.url" env:"OG_GITLAB_URL"`
|
GitlabUrl string `yaml:"gitlab.url" env:"OG_GITLAB_URL"`
|
||||||
|
GitlabName string `yaml:"gitlab.name" env:"OG_GITLAB_NAME"`
|
||||||
|
|
||||||
GiteaClientKey string `yaml:"gitea.client-key" env:"OG_GITEA_CLIENT_KEY"`
|
GiteaClientKey string `yaml:"gitea.client-key" env:"OG_GITEA_CLIENT_KEY"`
|
||||||
GiteaSecret string `yaml:"gitea.secret" env:"OG_GITEA_SECRET"`
|
GiteaSecret string `yaml:"gitea.secret" env:"OG_GITEA_SECRET"`
|
||||||
GiteaUrl string `yaml:"gitea.url" env:"OG_GITEA_URL"`
|
GiteaUrl string `yaml:"gitea.url" env:"OG_GITEA_URL"`
|
||||||
|
GiteaName string `yaml:"gitea.name" env:"OG_GITEA_NAME"`
|
||||||
|
|
||||||
OIDCClientKey string `yaml:"oidc.client-key" env:"OG_OIDC_CLIENT_KEY"`
|
OIDCClientKey string `yaml:"oidc.client-key" env:"OG_OIDC_CLIENT_KEY"`
|
||||||
OIDCSecret string `yaml:"oidc.secret" env:"OG_OIDC_SECRET"`
|
OIDCSecret string `yaml:"oidc.secret" env:"OG_OIDC_SECRET"`
|
||||||
|
@ -86,7 +88,10 @@ func configWithDefaults() (*config, error) {
|
||||||
c.SshPort = "2222"
|
c.SshPort = "2222"
|
||||||
c.SshKeygen = "ssh-keygen"
|
c.SshKeygen = "ssh-keygen"
|
||||||
|
|
||||||
|
c.GitlabName = "GitLab"
|
||||||
|
|
||||||
c.GiteaUrl = "https://gitea.com"
|
c.GiteaUrl = "https://gitea.com"
|
||||||
|
c.GiteaName = "Gitea"
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,8 +122,7 @@ auth.username: Uživatelské jméno
|
||||||
auth.password: Heslo
|
auth.password: Heslo
|
||||||
auth.register-instead: Raději se zaregistrovat
|
auth.register-instead: Raději se zaregistrovat
|
||||||
auth.login-instead: Raději se přihlásit
|
auth.login-instead: Raději se přihlásit
|
||||||
auth.github-oauth: Pokračovat s účtem na GitHubu
|
auth.oauth: Pokračovat s účtem na %s
|
||||||
auth.gitea-oauth: Pokračovat s účtem na Gitea
|
|
||||||
|
|
||||||
error: Chyba
|
error: Chyba
|
||||||
|
|
||||||
|
|
|
@ -132,9 +132,7 @@ auth.username: Username
|
||||||
auth.password: Password
|
auth.password: Password
|
||||||
auth.register-instead: Register instead
|
auth.register-instead: Register instead
|
||||||
auth.login-instead: Login instead
|
auth.login-instead: Login instead
|
||||||
auth.github-oauth: Continue with GitHub account
|
auth.oauth: Continue with %s account
|
||||||
auth.gitlab-oauth: Continue with GitLab account
|
|
||||||
auth.gitea-oauth: Continue with Gitea account
|
|
||||||
|
|
||||||
error: Error
|
error: Error
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,7 @@ auth.username: Nombre de usuario
|
||||||
auth.password: Contraseña
|
auth.password: Contraseña
|
||||||
auth.register-instead: Registrarse en su lugar
|
auth.register-instead: Registrarse en su lugar
|
||||||
auth.login-instead: Iniciar sesión en su lugar
|
auth.login-instead: Iniciar sesión en su lugar
|
||||||
auth.github-oauth: Continuar con cuenta de GitHub
|
auth.oauth: Continuar con cuenta de %s
|
||||||
auth.gitea-oauth: Continuar con cuenta de Gitea
|
|
||||||
|
|
||||||
error: Error
|
error: Error
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,7 @@ auth.username: Nom d'utilisateur
|
||||||
auth.password: Mot de passe
|
auth.password: Mot de passe
|
||||||
auth.register-instead: Je préfère m'inscrire
|
auth.register-instead: Je préfère m'inscrire
|
||||||
auth.login-instead: Je préfère me connecter
|
auth.login-instead: Je préfère me connecter
|
||||||
auth.github-oauth: Continuer avec un compte GitHub
|
auth.oauth: Continuer avec un compte %s
|
||||||
auth.gitea-oauth: Continuer avec un compte Gitea
|
|
||||||
|
|
||||||
error: Erreur
|
error: Erreur
|
||||||
|
|
||||||
|
|
|
@ -132,9 +132,7 @@ auth.username: Felhasználónév
|
||||||
auth.password: Jelszó
|
auth.password: Jelszó
|
||||||
auth.register-instead: Vagy regisztrálj
|
auth.register-instead: Vagy regisztrálj
|
||||||
auth.login-instead: Vagy jelentkezz be
|
auth.login-instead: Vagy jelentkezz be
|
||||||
auth.github-oauth: Folytatás GitHub fiókkal
|
auth.oauth: Folytatás %s fiókkal
|
||||||
auth.gitlab-oauth: Folytatás GitLab fiókkal
|
|
||||||
auth.gitea-oauth: Folytatás Gitea fiókkal
|
|
||||||
|
|
||||||
error: Hiba
|
error: Hiba
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,7 @@ auth.username: Nome de usuário
|
||||||
auth.password: Senha
|
auth.password: Senha
|
||||||
auth.register-instead: Registrar-se no lugar
|
auth.register-instead: Registrar-se no lugar
|
||||||
auth.login-instead: Entrar no lugar
|
auth.login-instead: Entrar no lugar
|
||||||
auth.github-oauth: Continuar com conta do GitHub
|
auth.oauth: Continuar com conta do %s
|
||||||
auth.gitea-oauth: Continuar com conta do Gitea
|
|
||||||
|
|
||||||
error: Erro
|
error: Erro
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,7 @@ auth.username: Имя пользователя
|
||||||
auth.password: Пароль
|
auth.password: Пароль
|
||||||
auth.register-instead: Зарегистрироваться
|
auth.register-instead: Зарегистрироваться
|
||||||
auth.login-instead: Войти
|
auth.login-instead: Войти
|
||||||
auth.github-oauth: Войти с помощью доступа GitHub
|
auth.oauth: Войти с помощью доступа %s
|
||||||
auth.gitea-oauth: Войти с помощью доступа Gitea
|
|
||||||
|
|
||||||
error: Ошибка
|
error: Ошибка
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,7 @@ auth.username: 用户名
|
||||||
auth.password: 密码
|
auth.password: 密码
|
||||||
auth.register-instead: 转到注册
|
auth.register-instead: 转到注册
|
||||||
auth.login-instead: 转到登录
|
auth.login-instead: 转到登录
|
||||||
auth.github-oauth: 使用 GitHub 账号继续
|
auth.oauth: 使用 %s 账号继续
|
||||||
auth.gitea-oauth: 使用 Gitea 账号继续
|
|
||||||
|
|
||||||
error: 错误
|
error: 错误
|
||||||
|
|
||||||
|
|
|
@ -124,9 +124,7 @@ auth.username: 使用者名稱
|
||||||
auth.password: 密碼
|
auth.password: 密碼
|
||||||
auth.register-instead: 註冊
|
auth.register-instead: 註冊
|
||||||
auth.login-instead: 登錄
|
auth.login-instead: 登錄
|
||||||
auth.github-oauth: 用 GitHub 帳號繼續
|
auth.oauth: 用 %s 帳號繼續
|
||||||
auth.gitlab-oauth: 用 GitLab 帳號繼續
|
|
||||||
auth.gitea-oauth: 用 Gitea 帳號繼續
|
|
||||||
|
|
||||||
error: 錯誤
|
error: 錯誤
|
||||||
|
|
||||||
|
|
2
templates/pages/admin_config.html
vendored
2
templates/pages/admin_config.html
vendored
|
@ -59,9 +59,11 @@
|
||||||
<dt>GitLab client Key</dt><dd>{{ .c.GitlabClientKey }}</dd>
|
<dt>GitLab client Key</dt><dd>{{ .c.GitlabClientKey }}</dd>
|
||||||
<dt>GitLab Secret</dt><dd>{{ .c.GitlabSecret }}</dd>
|
<dt>GitLab Secret</dt><dd>{{ .c.GitlabSecret }}</dd>
|
||||||
<dt>GitLab URL</dt><dd>{{ .c.GitlabUrl }}</dd>
|
<dt>GitLab URL</dt><dd>{{ .c.GitlabUrl }}</dd>
|
||||||
|
<dt>GitLab Name</dt><dd>{{ .c.GitlabName }}</dd>
|
||||||
<dt>Gitea client Key</dt><dd>{{ .c.GiteaClientKey }}</dd>
|
<dt>Gitea client Key</dt><dd>{{ .c.GiteaClientKey }}</dd>
|
||||||
<dt>Gitea Secret</dt><dd>{{ .c.GiteaSecret }}</dd>
|
<dt>Gitea Secret</dt><dd>{{ .c.GiteaSecret }}</dd>
|
||||||
<dt>Gitea URL</dt><dd>{{ .c.GiteaUrl }}</dd>
|
<dt>Gitea URL</dt><dd>{{ .c.GiteaUrl }}</dd>
|
||||||
|
<dt>Gitea Name</dt><dd>{{ .c.GiteaName }}</dd>
|
||||||
<dt>OIDC client Key</dt><dd>{{ .c.OIDCClientKey }}</dd>
|
<dt>OIDC client Key</dt><dd>{{ .c.OIDCClientKey }}</dd>
|
||||||
<dt>OIDC Secret</dt><dd>{{ .c.OIDCSecret }}</dd>
|
<dt>OIDC Secret</dt><dd>{{ .c.OIDCSecret }}</dd>
|
||||||
<dt>OIDC Discovery URL</dt><dd>{{ .c.OIDCDiscoveryUrl }}</dd>
|
<dt>OIDC Discovery URL</dt><dd>{{ .c.OIDCDiscoveryUrl }}</dd>
|
||||||
|
|
6
templates/pages/auth_form.html
vendored
6
templates/pages/auth_form.html
vendored
|
@ -63,17 +63,17 @@
|
||||||
<div>
|
<div>
|
||||||
{{ if .githubOauth }}
|
{{ if .githubOauth }}
|
||||||
<a href="{{ $.c.ExternalUrl }}/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
<a href="{{ $.c.ExternalUrl }}/oauth/github" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
{{ .locale.Tr "auth.github-oauth" }}
|
{{ .locale.Tr "auth.oauth" "GitHub"}}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .gitlabOauth }}
|
{{ if .gitlabOauth }}
|
||||||
<a href="{{ $.c.ExternalUrl }}/oauth/gitlab" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
<a href="{{ $.c.ExternalUrl }}/oauth/gitlab" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
{{ .locale.Tr "auth.gitlab-oauth" }}
|
{{ .locale.Tr "auth.oauth" .c.GitLabName}}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .giteaOauth }}
|
{{ if .giteaOauth }}
|
||||||
<a href="{{ $.c.ExternalUrl }}/oauth/gitea" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
<a href="{{ $.c.ExternalUrl }}/oauth/gitea" class="block w-full mb-2 text-center whitespace-nowrap text-slate-700 dark:text-slate-300{{ if .syncReposFromFS }} text-slate-500 cursor-not-allowed {{ end }}rounded border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 px-2.5 py-2 text-xs font-medium text-gray-700 dark:text-white shadow-sm hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-500 hover:text-slate-700 dark:hover:text-slate-300 focus:outline-none focus:ring-1 focus:border-primary-500 focus:ring-primary-500 leading-3">
|
||||||
{{ .locale.Tr "auth.gitea-oauth" }}
|
{{ .locale.Tr "auth.oauth" .c.GiteaName }}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .oidcOauth }}
|
{{ if .oidcOauth }}
|
||||||
|
|
Loading…
Reference in a new issue