1+ < h3 > Comparing with <%= user_link @target %> </ h3 >
2+
3+ < h4 > Email address</ h4 >
4+ < table class ="table is-full-width is-striped is-with-hover ">
5+ < thead >
6+ < tr >
7+ < th > </ th >
8+ < th > Handle</ th >
9+ < th > Domain</ th >
10+ </ tr >
11+ </ thead >
12+ < tbody >
13+ < tr >
14+ < td > < strong > <%= @user . rtl_safe_username %> </ strong > </ td >
15+ <% user_handle = Digest ::SHA2 . hexdigest ( @user . email . split ( '@' ) [ 0 ] ) %>
16+ <% target_handle = Digest ::SHA2 . hexdigest ( @target . email . split ( '@' ) [ 0 ] ) %>
17+ <% user_domain = Digest ::SHA2 . hexdigest ( @user . email . split ( '@' ) [ 1 ] ) %>
18+ <% target_domain = Digest ::SHA2 . hexdigest ( @target . email . split ( '@' ) [ 1 ] ) %>
19+ < td >
20+ < code class ="<%= 'has-background-color-red' if user_handle == target_handle %> ">
21+ <%= user_handle [ 0 ..7 ] %>
22+ </ code >
23+ </ td >
24+ < td >
25+ < code class ="<%= 'has-background-color-red' if user_domain == target_domain %> ">
26+ <%= user_domain [ 0 ..7 ] %>
27+ </ code > < br />
28+ <% domain_users = Rails . cache . hget 'user_email_domains' , @user . email . split ( '@' ) [ 1 ] %>
29+ <% if domain_users . nil? %>
30+ (unknown number of users)
31+ <% else %>
32+ Used by <%= pluralize ( domain_users , 'user' ) %>
33+ <% end %>
34+ </ td >
35+ </ tr >
36+ < tr >
37+ < td > < strong > <%= @target . rtl_safe_username %> </ strong > </ td >
38+ < td >
39+ < code class ="<%= 'has-background-color-red' if user_handle == target_handle %> ">
40+ <%= target_handle [ 0 ..7 ] %>
41+ </ code >
42+ </ td >
43+ < td >
44+ < code class ="<%= 'has-background-color-red' if user_domain == target_domain %> ">
45+ <%= target_domain [ 0 ..7 ] %>
46+ </ code > < br />
47+ <% domain_users = Rails . cache . hget 'user_email_domains' , @target . email . split ( '@' ) [ 1 ] %>
48+ <% if domain_users . nil? %>
49+ (unknown number of users)
50+ <% else %>
51+ Used by <%= pluralize ( domain_users , 'user' ) %>
52+ <% end %>
53+ </ td >
54+ </ tr >
55+ </ tbody >
56+ </ table > < br />
57+
58+ < h4 > IP addresses</ h4 >
59+
60+ <% user_current_family , user_current_ip = split_hash_ip ( @user . current_sign_in_ip , @user ) %>
61+ <% user_joiner = user_current_family == 'IPv4' ? '.' : ':' %>
62+ <% target_current_family , target_current_ip = split_hash_ip ( @target . current_sign_in_ip , @user ) %>
63+ <% target_joiner = target_current_family == 'IPv4' ? '.' : ':' %>
64+ < strong > Current sign-in</ strong > < br />
65+ < table class ="table is-striped is-with-hover ">
66+ < thead >
67+ < tr >
68+ < th > User</ th >
69+ < th > Family</ th >
70+ < th > Address</ th >
71+ </ tr >
72+ </ thead >
73+ < tbody >
74+ < tr >
75+ < td > <%= @user . rtl_safe_username %> </ td >
76+ < td > <%= user_current_family %> </ td >
77+ < td >
78+ <% user_current_ip . map . with_index do |p , i | %>
79+ < code class ="<%= 'has-background-color-red' if p == target_current_ip [ i ] %> ">
80+ <%= p [ 0 ..3 ] %> </ code > <%= user_joiner if i < user_current_ip . length - 1 %>
81+ <% end %>
82+ </ td >
83+ </ tr >
84+ < tr >
85+ < td > <%= @target . rtl_safe_username %> </ td >
86+ < td > <%= target_current_family %> </ td >
87+ < td >
88+ <% target_current_ip . map . with_index do |p , i | %>
89+ < code class ="<%= 'has-background-color-red' if p == user_current_ip [ i ] %> ">
90+ <%= p [ 0 ..3 ] %> </ code > <%= target_joiner if i < target_current_ip . length - 1 %>
91+ <% end %>
92+ </ td >
93+ </ tr >
94+ </ tbody >
95+ </ table > < br />
96+
97+ <% user_last_family , user_last_ip = split_hash_ip ( @user . last_sign_in_ip , @user ) %>
98+ <% user_joiner = user_last_family == 'IPv4' ? '.' : ':' %>
99+ <% target_last_family , target_last_ip = split_hash_ip ( @target . last_sign_in_ip , @user ) %>
100+ <% target_joiner = target_last_family == 'IPv4' ? '.' : ':' %>
101+ < strong > Last sign-in</ strong > < br />
102+ < table class ="table is-striped is-with-hover ">
103+ < thead >
104+ < tr >
105+ < th > User</ th >
106+ < th > Family</ th >
107+ < th > Address</ th >
108+ </ tr >
109+ </ thead >
110+ < tbody >
111+ < tr >
112+ < td > <%= @user . rtl_safe_username %> </ td >
113+ < td > <%= user_last_family %> </ td >
114+ < td >
115+ <% user_last_ip . map . with_index do |p , i | %>
116+ < code class ="<%= 'has-background-color-red' if p == target_last_ip [ i ] %> ">
117+ <%= p [ 0 ..3 ] %> </ code > <%= user_joiner if i < user_last_ip . length - 1 %>
118+ <% end %>
119+ </ td >
120+ </ tr >
121+ < tr >
122+ < td > <%= @target . rtl_safe_username %> </ td >
123+ < td > <%= target_last_family %> </ td >
124+ < td >
125+ <% target_last_ip . map . with_index do |p , i | %>
126+ < code class ="<%= 'has-background-color-red' if p == user_last_ip [ i ] %> ">
127+ <%= p [ 0 ..3 ] %> </ code > <%= target_joiner if i < target_last_ip . length - 1 %>
128+ <% end %>
129+ </ td >
130+ </ tr >
131+ </ tbody >
132+ </ table >
0 commit comments