summaryrefslogtreecommitdiff
path: root/app/views/admin/users/show.html.haml
blob: fff4bd70cde953c712046f018ed852220623b5de (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
- page_title @user.name, "用户"
= render 'admin/users/head'

.row
  .col-md-6
    .panel.panel-default
      .panel-heading
        = @user.name
      %ul.well-list
        %li
          = image_tag avatar_icon(@user, 60), class: "avatar s60"
        %li
          %span.light 个人资料页面:
          %strong
            = link_to user_path(@user) do
              = @user.username
    = render 'admin/users/profile', user: @user

    .panel.panel-default
      .panel-heading
        账号:
      %ul.well-list
        %li
          %span.light 姓名:
          %strong= @user.name
        %li
          %span.light 用户名:
          %strong
            = @user.username
        %li
          %span.light 电子邮箱:
          %strong
            = mail_to @user.email
        - @user.emails.each do |email|
          %li
            %span.light 第二电子邮箱:
            %strong= email.email
            = link_to remove_email_admin_user_path(@user, email), data: { confirm: "确定要删除 #{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

        %li.two-factor-status
          %span.light 两步验证:
          %strong{class: @user.two_factor_enabled? ? 'cgreen' : 'cred'}
            - if @user.two_factor_enabled?
              已启用
              = link_to '禁用', disable_two_factor_admin_user_path(@user), data: {confirm: '确定要继续么?'}, method: :patch, class: 'btn btn-xs btn-remove pull-right', title: 'Disable Two-factor Authentication'
            - else
              已禁用

        %li
          %span.light 外部用户:
          %strong
            = @user.external? ? "是" : "否"
        %li
          %span.light 是否可以创建群组:
          %strong
            = @user.can_create_group ? "是" : "否"
        %li
          %span.light 个人项目限制:
          %strong
            = @user.projects_limit
        %li
          %span.light 注册时间:
          %strong
            = @user.created_at.to_s(:medium)
        - if @user.confirmed_at
          %li
            %span.light 确认时间:
            %strong
              = @user.confirmed_at.to_s(:medium)
        - else
          %li
            %span.light 已确认:
            %strong.cred
              否

        %li
          %span.light 当前登入 IP:
          %strong
            - if @user.current_sign_in_ip
              = @user.current_sign_in_ip
            - else
              从未

        %li
          %span.light 当前登入时间:
          %strong
            - if @user.current_sign_in_at
              = @user.current_sign_in_at.to_s(:medium)
            - else
              从未

        %li
          %span.light 上次登入 IP:
          %strong
            - if @user.last_sign_in_ip
              = @user.last_sign_in_ip
            - else
              从未

        %li
          %span.light 上次登入时间:
          %strong
            - if @user.last_sign_in_at
              = @user.last_sign_in_at.to_s(:medium)
            - else
              从未

        %li
          %span.light 登入次数:
          %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 创建者:
            %strong
              = link_to @user.created_by.name, [:admin, @user.created_by]

  .col-md-6
    - unless @user == current_user
      - unless @user.confirmed?
        .panel.panel-info
          .panel-heading
            确认用户
          .panel-body
            - if @user.unconfirmed_email.present?
              - email = " (#{@user.unconfirmed_email})"
            %p 此用户有一个未确认的电子邮箱地址 #{email}。你可以强制确认。
            %br
            = link_to '确认用户', confirm_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: '确认要继续么?' }
      - if @user.blocked?
        .panel.panel-info
          .panel-heading
            该用户被禁用
          .panel-body
            %p 禁用用户有如下效果:
            %ul
              %li 用户无法登入
              %li 用户无法访问 git 版本仓库
              %li 个人项目将被移除
              %li 拥有的群组将被移除
            %br
            = link_to '启用用户', unblock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: '确认要继续么?' }
      - else
        .panel.panel-warning
          .panel-heading
            禁用用户
          .panel-body
            %p 禁用用户有如下效果:
            %ul
              %li 用户无法登入
              %li 用户无法访问 git 版本仓库
              %li 用户将从加入的项目和群组中删除
              %li 个人项目将被移除
              %li 拥有的群组将被移除
            %br
            = link_to '禁用用户', block_admin_user_path(@user), data: { confirm: '用户将被禁用!确定要继续么?' }, method: :put, class: "btn btn-warning"
      - if @user.access_locked?
        .panel.panel-info
          .panel-heading
            此账户已被锁定
          .panel-body
            %p 此用户因为登录失败过多而被临时锁定。可以手动解锁此账户。
            %br
            = link_to '解锁用户', unlock_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: '确定要继续么?' }

      .panel.panel-danger
        .panel-heading
          删除用户
        .panel-body
          - if @user.can_be_removed?
            %p 删除用户有如下效果:
            %ul
              %li 全部用户内容,比如:问题、代码片段、注释都将被删除
              - rp = @user.personal_projects.count
              - unless rp.zero?
                %li #{pluralize rp, '个个人项目', '个个人项目'}将被删除并无法恢复
            %br
            = link_to '删除用户', [:admin, @user], data: { confirm: "用户 #{@user.name} 将被删除!确定要继续么?" }, method: :delete, class: "btn btn-remove"
          - else
            - if @user.solo_owned_groups.present?
              %p
                此用户当前拥有以下群组:
                %strong #{@user.solo_owned_groups.map(&:name).join(', ')}
              %p
                在删除此用户前,请转移这些群组的所有权或删除之。