show.html.haml 3.7 KB
Newer Older
D
Douwe Maan 已提交
1
- page_title "Account"
2 3
- if current_user.ldap_user?
  .alert.alert-info
D
Dmitriy Zaporozhets 已提交
4 5
    Some options are unavailable for LDAP accounts

6
.account-page
D
Dmitriy Zaporozhets 已提交
7 8
  %fieldset.update-token
    %legend
9
      Reset Private token
D
Dmitriy Zaporozhets 已提交
10 11 12 13 14 15 16 17 18 19 20 21
    %div
      = form_for @user, url: reset_private_token_profile_path, method: :put do |f|
        .data
          %p
            Your private token is used to access application resources without authentication.
            %br
            It can be used for atom feeds or the API.
            %span.cred
              Keep it secret!

          %p.cgray
            - if current_user.private_token
D
Dmitriy Zaporozhets 已提交
22 23
              = text_field_tag "token", current_user.private_token, class: "form-control"
              %div
24
                = f.submit 'Reset private token', data: { confirm: "Are you sure?" }, class: "btn btn-primary btn-build-token"
D
Dmitriy Zaporozhets 已提交
25 26 27 28
            - else
              %span You don`t have one yet. Click generate to fix it.
              = f.submit 'Generate', class: "btn success btn-build-token"

29 30 31 32
  %fieldset
    %legend Two-Factor Authentication
    %p
      Keep your account secure by enabling two-factor authentication.
33
      %br
34 35
      Each time you log in, you’ll be required to provide your password plus a randomly generated access code.
    %div
36 37 38 39 40 41 42 43
      - if current_user.otp_required_for_login
        %strong.text-success
          %i.fa.fa-check
          2-Factor Authentication enabled
        .pull-right
          = link_to "Disable 2-Factor Authentication", profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm'
      - else
        = link_to "Enable 2-Factor Authentication", new_profile_two_factor_auth_path, class: 'btn btn-success'
D
Dmitriy Zaporozhets 已提交
44 45 46

  - if show_profile_social_tab?
    %fieldset
47 48
      %legend Connected Accounts
      .oauth-buttons.append-bottom-10
D
Dmitriy Zaporozhets 已提交
49 50
        %p Click on icon to activate signin with one of the following services
        - enabled_social_providers.each do |provider|
51 52 53 54 55 56
          .btn-group
            = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider),
              class: "btn btn-lg #{'active' if oauth_active?(provider)}"
            - if oauth_active?(provider)
              = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
                %i.fa.fa-close
D
Dmitriy Zaporozhets 已提交
57 58 59 60

  - if show_profile_username_tab?
    %fieldset.update-username
      %legend
61
        Change Username
D
Dmitriy Zaporozhets 已提交
62 63
      = form_for @user, url: update_username_profile_path,  method: :put, remote: true do |f|
        %p
J
Jeroen van Baarsen 已提交
64
          Changing your username will change path to all personal projects!
D
Dmitriy Zaporozhets 已提交
65
        %div
D
Dmitriy Zaporozhets 已提交
66
          = f.text_field :username, required: true, class: 'form-control'
D
Dmitriy Zaporozhets 已提交
67
           
68 69
        .loading-gif.hide
          %p
S
Sullivan SENECHAL 已提交
70
            %i.fa.fa-spinner.fa-spin
71
            Saving new username
D
Dmitriy Zaporozhets 已提交
72 73 74
        %p.light
          = user_url(@user)
        %div
S
Sabba Petri 已提交
75
          = f.submit 'Save username', class: "btn btn-warning"
D
Dmitriy Zaporozhets 已提交
76 77 78 79 80 81 82 83 84 85 86 87 88 89

  - if show_profile_remove_tab?
    %fieldset.remove-account
      %legend
        Remove account
      %div
        %p Deleting an account has the following effects:
        %ul
          %li All user content like authored issues, snippets, comments will be removed
          - rp = current_user.personal_projects.count
          - unless rp.zero?
            %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
          - if current_user.solo_owned_groups.present?
            %li
90
              The following groups will be abandoned. You should transfer or remove them:
D
Dmitriy Zaporozhets 已提交
91
              %strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
D
Dmitriy Zaporozhets 已提交
92
        = link_to 'Delete account', user_registration_path, data: { confirm: "REMOVE #{current_user.name}? Are you sure?" }, method: :delete, class: "btn btn-remove"
V
Valery Sizov 已提交
93