You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

keys_ssh.tmpl 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <h4 class="ui top attached header">
  2. {{.locale.Tr "settings.manage_ssh_keys"}}
  3. <div class="ui right">
  4. {{if not .DisableSSH}}
  5. <div id="add-ssh-button" class="ui primary tiny show-panel button" data-panel="#add-ssh-key-panel">
  6. {{.locale.Tr "settings.add_key"}}
  7. </div>
  8. {{else}}
  9. <div class="ui primary tiny button disabled">{{.locale.Tr "settings.ssh_disabled"}}</div>
  10. {{end}}
  11. </div>
  12. </h4>
  13. <div class="ui attached segment">
  14. <div class="{{if not .HasSSHError}}gt-hidden{{end}} gt-mb-4" id="add-ssh-key-panel">
  15. <form class="ui form" action="{{.Link}}" method="post">
  16. {{.CsrfTokenHtml}}
  17. <div class="field {{if .Err_Title}}error{{end}}">
  18. <label for="title">{{.locale.Tr "settings.key_name"}}</label>
  19. <input id="ssh-key-title" name="title" value="{{.title}}" autofocus required>
  20. </div>
  21. <div class="field {{if .Err_Content}}error{{end}}">
  22. <label for="content">{{.locale.Tr "settings.key_content"}}</label>
  23. <textarea id="ssh-key-content" name="content" class="js-quick-submit" placeholder="{{.locale.Tr "settings.key_content_ssh_placeholder"}}" required>{{.content}}</textarea>
  24. </div>
  25. <input name="type" type="hidden" value="ssh">
  26. <button class="ui green button">
  27. {{.locale.Tr "settings.add_key"}}
  28. </button>
  29. <button id="cancel-ssh-button" class="ui hide-panel button" data-panel="#add-ssh-key-panel">
  30. {{.locale.Tr "cancel"}}
  31. </button>
  32. </form>
  33. </div>
  34. <div class="ui key list gt-mt-0">
  35. <div class="item">
  36. {{.locale.Tr "settings.ssh_desc"}}
  37. </div>
  38. {{range $index, $key := .Keys}}
  39. <div class="item">
  40. <div class="right floated content">
  41. <button class="ui red tiny button delete-button{{if index $.ExternalKeys $index}} disabled{{end}}" data-modal-id="delete-ssh" data-url="{{$.Link}}/delete?type=ssh" data-id="{{.ID}}"{{if index $.ExternalKeys $index}} title="{{$.locale.Tr "settings.ssh_externally_managed"}}"{{end}}>
  42. {{$.locale.Tr "settings.delete_key"}}
  43. </button>
  44. {{if and (not .Verified) (ne $.VerifyingFingerprint .Fingerprint)}}
  45. <a class="ui primary tiny show-panel button" href="{{$.Link}}?verify_ssh={{.Fingerprint}}">{{$.locale.Tr "settings.ssh_key_verify"}}</a>
  46. {{end}}
  47. </div>
  48. <div class="left floated content">
  49. <span class="tooltip{{if .HasRecentActivity}} green{{end}}" {{if .HasRecentActivity}}data-content="{{$.locale.Tr "settings.key_state_desc"}}"{{end}}>{{svg "octicon-key" 32}}</span>
  50. </div>
  51. <div class="content">
  52. {{if .Verified}}
  53. <span class="tooltip" data-content="{{$.locale.Tr "settings.ssh_key_verified_long"}}">{{svg "octicon-shield-check"}} <strong>{{$.locale.Tr "settings.ssh_key_verified"}}</strong></span>
  54. {{end}}
  55. <strong>{{.Name}}</strong>
  56. <div class="print meta">
  57. {{.Fingerprint}}
  58. </div>
  59. <div class="activity meta">
  60. <i>{{$.locale.Tr "settings.add_on"}} <span><time data-format="short-date" datetime="{{.CreatedUnix.FormatLong}}">{{.CreatedUnix.FormatShort}}</time></span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}><time data-format="short-date" datetime="{{.UpdatedUnix.FormatLong}}">{{.UpdatedUnix.FormatShort}}</time></span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
  61. </div>
  62. </div>
  63. </div>
  64. {{if and (not .Verified) (eq $.VerifyingFingerprint .Fingerprint)}}
  65. <div class="ui segment">
  66. <h4>{{$.locale.Tr "settings.ssh_token_required"}}</h4>
  67. <form class="ui form{{if $.HasSSHVerifyError}} error{{end}}" action="{{$.Link}}" method="post">
  68. {{$.CsrfTokenHtml}}
  69. <input type="hidden" name="title" value="none">
  70. <input type="hidden" name="content" value="{{.Content}}">
  71. <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
  72. <div class="field">
  73. <label for="token">{{$.locale.Tr "settings.ssh_token"}}</label>
  74. <input readonly="" value="{{$.TokenToSign}}">
  75. <div class="help">
  76. <p>{{$.locale.Tr "settings.ssh_token_help"}}</p>
  77. <p><code>{{printf "echo -n '%s' | ssh-keygen -Y sign -n gitea -f /path_to_your_privkey" $.TokenToSign}}</code></p>
  78. </div>
  79. <br>
  80. </div>
  81. <div class="field">
  82. <label for="signature">{{$.locale.Tr "settings.ssh_token_signature"}}</label>
  83. <textarea id="ssh-key-signature" name="signature" class="js-quick-submit" placeholder="{{$.locale.Tr "settings.key_signature_ssh_placeholder"}}" required>{{$.signature}}</textarea>
  84. </div>
  85. <input name="type" type="hidden" value="verify_ssh">
  86. <button class="ui green button">
  87. {{$.locale.Tr "settings.ssh_key_verify"}}
  88. </button>
  89. <a class="ui red button" href="{{$.Link}}">
  90. {{$.locale.Tr "settings.cancel"}}
  91. </a>
  92. </form>
  93. </div>
  94. {{end}}
  95. {{end}}
  96. </div>
  97. </div>
  98. <br>
  99. <p>{{.locale.Tr "settings.ssh_helper" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh" "https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/troubleshooting-ssh" | Str2html}}</p>
  100. <div class="ui small basic delete modal" id="delete-ssh">
  101. <div class="ui icon header">
  102. {{svg "octicon-trash"}}
  103. {{.locale.Tr "settings.ssh_key_deletion"}}
  104. </div>
  105. <div class="content">
  106. <p>{{.locale.Tr "settings.ssh_key_deletion_desc"}}</p>
  107. </div>
  108. {{template "base/delete_modal_actions" .}}
  109. </div>