diff options
author | Stefan Kalscheuer <stefan@stklcode.de> | 2017-07-15 16:21:51 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-07-15 22:21:51 +0800 |
commit | 0b177574c92b2f8c4a4d0d9de01ff1bf5eda06a2 (patch) | |
tree | 9b0d900298ec2054b216271c556500c25ab7ddf5 /templates/repo/home.tmpl | |
parent | 32f289ae3b88f0a33723fe51b808d1633cd6716a (diff) | |
download | gitea-0b177574c92b2f8c4a4d0d9de01ff1bf5eda06a2.tar.gz gitea-0b177574c92b2f8c4a4d0d9de01ff1bf5eda06a2.zip |
Only show SSH clone URL if signed in (#2169) (#2170)
* Add configuration flag SSH_EXPOSE_ANONYMOUS
If this flag (default True) is set to false, the SSH clone URL will only be exposed if the current user is signed in.
* Default SSH exposure set to false
To match GitHub and for security reasons, SSH URL exposure is disabled by default.
In addition to that. minor code changes have been applied.
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
* Add integration tests
* Hide clone button neither HTTP and SSH is enabled
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
Diffstat (limited to 'templates/repo/home.tmpl')
-rw-r--r-- | templates/repo/home.tmpl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 664326c562..5af574ee04 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -56,19 +56,21 @@ {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}} </button> {{end}} - {{if not $.DisableSSH}} + {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}} <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}"> SSH </button> {{end}} {{if not $.DisableHTTP}} <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly> - {{else}} + {{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}} <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly> {{end}} - <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> - <i class="octicon octicon-clippy"></i> - </button> + {{if or ((not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)))}} + <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url"> + <i class="octicon octicon-clippy"></i> + </button> + {{end}} <div class="ui basic jump dropdown icon button poping up" data-content="{{.i18n.Tr "repo.download_archive"}}" data-variation="tiny inverted" data-position="top right"> <i class="download icon"></i> <div class="menu"> |