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
      - if current_user.otp_required_for_login
        %legend.text-success
33 34
          = icon('check')
          Two-factor Authentication enabled
35
        %div
36
          .pull-right
37
            = link_to 'Disable Two-factor Authentication', profile_two_factor_auth_path, method: :delete, class: 'btn btn-close btn-sm',
38
                data: { confirm: 'Are you sure?' }
39
          %p
40
            If you lose your recovery codes you can
41
            %strong
42
              = succeed ',' do
43
                = link_to 'generate new ones', codes_profile_two_factor_auth_path, method: :post, data: { confirm: 'Are you sure?' }
44
            invalidating all previous codes.
45 46

      - else
47
        %legend Two-factor Authentication
48 49
        %div
          %p
R
Robert Speicher 已提交
50 51 52 53
            Increase your account's security by enabling two-factor authentication (2FA).
          %p
            Each time you log in you’ll be required to provide your username and
            password as usual, plus a randomly-generated code from your phone.
54
          %div
55
            = link_to 'Enable Two-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
          .btn-group
            = link_to oauth_image_tag(provider), omniauth_authorize_path(User, provider),
65
              method: :post, class: "btn btn-lg #{'active' if oauth_active?(provider)}"
66 67
            - if oauth_active?(provider)
              = link_to unlink_profile_account_path(provider: provider), method: :delete, class: 'btn btn-lg' do
68
                = icon('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
82
            = icon('spinner 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