show.html.haml 6.2 KB
Newer Older
D
Douwe Maan 已提交
1
- page_title @user.name, "Users"
D
Dmitriy Zaporozhets 已提交
2
= render 'admin/users/head'
D
Dmitriy Zaporozhets 已提交
3 4 5 6 7 8 9 10

.row
  .col-md-6
    .panel.panel-default
      .panel-heading
        = @user.name
      %ul.well-list
        %li
11
          = image_tag avatar_icon(@user, 60), class: "avatar s60"
D
Dmitriy Zaporozhets 已提交
12 13 14 15 16
        %li
          %span.light Profile page:
          %strong
            = link_to user_path(@user) do
              = @user.username
17
    = render 'admin/users/profile', user: @user
D
Dmitriy Zaporozhets 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

    .panel.panel-default
      .panel-heading
        Account:
      %ul.well-list
        %li
          %span.light Name:
          %strong= @user.name
        %li
          %span.light Username:
          %strong
            = @user.username
        %li
          %span.light Email:
          %strong
            = mail_to @user.email
        - @user.emails.each do |email|
          %li
            %span.light Secondary email:
            %strong= email.email
            = link_to remove_email_admin_user_path(@user, email), data: { confirm: "Are you sure you want to remove #{email.email}?" }, method: :delete, class: "btn-xs btn btn-remove pull-right", title: 'Remove secondary email', id: "remove_email_#{email.id}" do
              %i.fa.fa-times

41 42 43 44 45
        %li.two-factor-status
          %span.light Two-factor Authentication:
          %strong{class: @user.two_factor_enabled? ? 'cgreen' : 'cred'}
            - if @user.two_factor_enabled?
              Enabled
46
              = link_to 'Disable', disable_two_factor_admin_user_path(@user), data: {confirm: 'Are you sure?'}, method: :patch, class: 'btn btn-xs btn-remove pull-right', title: 'Disable Two-factor Authentication'
47
            - else
48 49
              Disabled

D
Dmitriy Zaporozhets 已提交
50 51 52 53 54 55 56 57 58 59 60
        %li
          %span.light Can create groups:
          %strong
            = @user.can_create_group ? "Yes" : "No"
        %li
          %span.light Personal projects limit:
          %strong
            = @user.projects_limit
        %li
          %span.light Member since:
          %strong
R
Robert Speicher 已提交
61
            = @user.created_at.strftime('%b %-d, %Y')
D
Dmitriy Zaporozhets 已提交
62 63 64 65
        - if @user.confirmed_at
          %li
            %span.light Confirmed at:
            %strong
R
Robert Speicher 已提交
66
              = @user.confirmed_at.strftime('%b %-d, %Y')
D
Dmitriy Zaporozhets 已提交
67 68 69 70 71 72 73 74 75 76
        - else
          %li
            %span.light Confirmed:
            %strong.cred
              No

        %li
          %span.light Current sign-in at:
          %strong
            - if @user.current_sign_in_at
R
Robert Speicher 已提交
77
              = @user.current_sign_in_at.strftime('%b %-d, %Y')
78
            - else
D
Dmitriy Zaporozhets 已提交
79
              never
80

D
Dmitriy Zaporozhets 已提交
81 82 83 84
        %li
          %span.light Last sign-in at:
          %strong
            - if @user.last_sign_in_at
R
Robert Speicher 已提交
85
              = @user.last_sign_in_at.strftime('%b %-d, %Y')
D
Dmitriy Zaporozhets 已提交
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
            - else
              never

        %li
          %span.light Sign-in count:
          %strong
            = @user.sign_in_count

        - if @user.ldap_user?
          %li
            %span.light LDAP uid:
            %strong
              = @user.ldap_identity.extern_uid

        - if @user.created_by
          %li
            %span.light Created by:
            %strong
              = link_to @user.created_by.name, [:admin, @user.created_by]

  .col-md-6
    - unless @user == current_user
108 109 110 111 112 113 114 115 116 117
      - unless @user.confirmed?
        .panel.panel-info
          .panel-heading
            Confirm user
          .panel-body
            - if @user.unconfirmed_email.present?
              - email = " (#{@user.unconfirmed_email})"
            %p This user has an unconfirmed email address#{email}. You may force a confirmation.
            %br
            = link_to 'Confirm user', confirm_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' }
D
Dmitriy Zaporozhets 已提交
118 119
      - if @user.blocked?
        .panel.panel-info
D
Dmitriy Zaporozhets 已提交
120
          .panel-heading
D
Dmitriy Zaporozhets 已提交
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
            This user is blocked
          .panel-body
            %p Blocking user has the following effects:
            %ul
              %li User will not be able to login
              %li User will not be able to access git repositories
              %li Personal projects will be left
              %li Owned groups will be left
            %br
            = link_to 'Unblock user', unblock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' }
      - else
        .panel.panel-warning
          .panel-heading
            Block this user
          .panel-body
            %p Blocking user has the following effects:
            %ul
              %li User will not be able to login
              %li User will not be able to access git repositories
              %li User will be removed from joined projects and groups
              %li Personal projects will be left
              %li Owned groups will be left
            %br
            = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-warning"
145 146 147 148 149 150 151 152
      - if @user.access_locked?
        .panel.panel-info
          .panel-heading
            This account has been locked
          .panel-body
            %p This user has been temporarily locked due to excessive number of failed logins. You may manually unlock the account.
            %br
            = link_to 'Unlock user', unlock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' }
D
Dmitriy Zaporozhets 已提交
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173

      .panel.panel-danger
        .panel-heading
          Remove user
        .panel-body
          - if @user.can_be_removed?
            %p Deleting a user has the following effects:
            %ul
              %li All user content like authored issues, snippets, comments will be removed
              - rp = @user.personal_projects.count
              - unless rp.zero?
                %li #{pluralize rp, 'personal project'} will be removed and cannot be restored
            %br
            = link_to 'Remove user', [:admin, @user], data: { confirm: "USER #{@user.name} WILL BE REMOVED! Are you sure?" }, method: :delete, class: "btn btn-remove"
          - else
            - if @user.solo_owned_groups.present?
              %p
                This user is currently an owner in these groups:
                %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
              %p
                You must transfer ownership or delete these groups before you can delete this user.