summaryrefslogtreecommitdiff
path: root/app/views/profiles/keys/_form.html.haml
blob: 2b3109225a83d041f8ef46183a2a7285a0cb2908 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
- max_date = ::Gitlab::CurrentSettings.max_ssh_key_lifetime_from_now.to_date if ssh_key_expiration_policy_enabled?
%div
  = form_for [:profile, @key], html: { class: 'js-requires-input' } do |f|
    = form_errors(@key)

    .form-group
      = f.label :key, s_('Profiles|Key'), class: 'label-bold'
      %p= _("Paste your public SSH key, which is usually contained in the file '~/.ssh/id_ed25519.pub' or '~/.ssh/id_rsa.pub' and begins with 'ssh-ed25519' or 'ssh-rsa'. Do not paste your private SSH key, as that can compromise your identity.")
      = f.text_area :key, class: "form-control gl-form-input js-add-ssh-key-validation-input qa-key-public-key-field", rows: 8, required: true, placeholder: s_('Profiles|Typically starts with "ssh-ed25519 …" or "ssh-rsa …"')
    .form-row
      .col.form-group
        = f.label :title, _('Title'), class: 'label-bold'
        = f.text_field :title, class: "form-control gl-form-input input-lg qa-key-title-field", required: true, placeholder: s_('Profiles|e.g. My MacBook key')
        %p.form-text.text-muted= s_('Profiles|Give your individual key a title. This will be publicly visible.')

      .col.form-group
        = f.label :expires_at, s_('Profiles|Expiration date'), class: 'label-bold'
        = f.date_field :expires_at, class: "form-control input-lg", min: Date.tomorrow, max: max_date, data: { qa_selector: 'key_expiry_date_field' }
        %p.form-text.text-muted{ data: { qa_selector: 'key_expiry_date_field_description' } }= ssh_key_expires_field_description

    .js-add-ssh-key-validation-warning.hide
      .bs-callout.bs-callout-warning{ role: 'alert', aria_live: 'assertive' }
        %strong= _('Oops, are you sure?')
        %p= s_("Profiles|Publicly visible private SSH keys can compromise your system.")

      %button.btn.gl-button.btn-confirm.js-add-ssh-key-validation-confirm-submit= _("Yes, add it")

    .gl-mt-3
      = f.submit s_('Profiles|Add key'), class: "gl-button btn btn-confirm js-add-ssh-key-validation-original-submit qa-add-key-button"