show.html.haml 4.2 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
  - unless current_user.ldap_user?
    %fieldset
31 32 33 34 35
      - if current_user.otp_required_for_login
        %legend.text-success
          %i.fa.fa-check
          Two-Factor Authentication enabled
        %div
36 37
          .pull-right
            = link_to "Disable 2-Factor Authentication", profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm'
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
          %p.slead
            %i.fa.fa-warning
            Please
            %strong #{link_to "download recovery codes", codes_profile_two_factor_auth_path}
            so you can access your account if you lose your phone.
            %br
            %i.fa.fa-warning
            Every time you download recovery codes - we generate the new codes. Previously downloaded codes won't work anymore.

      - else
        %legend Two-Factor Authentication
        %div
          %p
            Keep your account secure by enabling two-factor authentication.
            %br
            Each time you log in, you’ll be required to provide your password plus a randomly generated access code.
          %div
            = link_to "Enable 2-Factor Authentication", new_profile_two_factor_auth_path, class: 'btn btn-success'
D
Dmitriy Zaporozhets 已提交
56 57 58

  - if show_profile_social_tab?
    %fieldset
59 60
      %legend Connected Accounts
      .oauth-buttons.append-bottom-10
D
Dmitriy Zaporozhets 已提交
61 62
        %p Click on icon to activate signin with one of the following services
        - enabled_social_providers.each do |provider|
63 64 65 66 67 68
          .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 已提交
69 70 71 72

  - if show_profile_username_tab?
    %fieldset.update-username
      %legend
73
        Change Username
D
Dmitriy Zaporozhets 已提交
74 75
      = form_for @user, url: update_username_profile_path,  method: :put, remote: true do |f|
        %p
J
Jeroen van Baarsen 已提交
76
          Changing your username will change path to all personal projects!
D
Dmitriy Zaporozhets 已提交
77
        %div
D
Dmitriy Zaporozhets 已提交
78
          = f.text_field :username, required: true, class: 'form-control'
D
Dmitriy Zaporozhets 已提交
79
           
80 81
        .loading-gif.hide
          %p
S
Sullivan SENECHAL 已提交
82
            %i.fa.fa-spinner.fa-spin
83
            Saving new username
D
Dmitriy Zaporozhets 已提交
84 85 86
        %p.light
          = user_url(@user)
        %div
S
Sabba Petri 已提交
87
          = f.submit 'Save username', class: "btn btn-warning"
D
Dmitriy Zaporozhets 已提交
88 89 90 91 92 93 94 95 96 97 98 99 100 101

  - 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
102
              The following groups will be abandoned. You should transfer or remove them:
D
Dmitriy Zaporozhets 已提交
103
              %strong #{current_user.solo_owned_groups.map(&:name).join(', ')}
D
Dmitriy Zaporozhets 已提交
104
        = 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 已提交
105