parent
0baf7c521f
commit
6112c13b34
|
@ -26,9 +26,9 @@
|
|||
</td>
|
||||
<div id="children_tree">
|
||||
<td class="tree-author c_grey">
|
||||
<div class="hidden" id="changes_author_<%= tr_id %>">
|
||||
<%#= (latest_changes.author_name) if latest_changes %>
|
||||
</div>
|
||||
<!--<div class="hidden" id="changes_author_<%= tr_id %>">-->
|
||||
<!--<%#= (latest_changes.author_name) if latest_changes %>-->
|
||||
<!--</div>-->
|
||||
</td>
|
||||
<td class="tree-comments c_grey hidden">
|
||||
<div class="hidden" id="changes_message_<%= tr_id %>">
|
||||
|
|
|
@ -34,10 +34,14 @@ module Trustie
|
|||
begin
|
||||
u = find_user(user)
|
||||
unless u
|
||||
login = user.try(:login)
|
||||
if login.include?("@") || login.end_with?(".")
|
||||
login = generate_username
|
||||
end
|
||||
u = self.g.create_user(user.mail,
|
||||
user.hashed_password,
|
||||
name: user.show_name,
|
||||
username: user.login,
|
||||
username: login,
|
||||
confirm: "true")
|
||||
user.gid = u.id
|
||||
user.save
|
||||
|
@ -53,6 +57,13 @@ module Trustie
|
|||
return u
|
||||
end
|
||||
|
||||
def generate_username
|
||||
code = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
|
||||
code = code.sample(8).join
|
||||
code = down_generate_identifier if User.where(login: code).present?
|
||||
return code
|
||||
end
|
||||
|
||||
def del_user(user)
|
||||
return unless user.gid
|
||||
self.g.delete_user(user.gid)
|
||||
|
|
Loading…
Reference in New Issue