Skip to content
Snippets Groups Projects
Commit 4fb1a008 authored by John Ma's avatar John Ma Committed by Jesus Federico
Browse files

Fixed #255

* <Fixed how uid was generated>

* <Fixed code style>

* <Removed unnecessary downcase call>
parent 074a002a
Branches
Tags
No related merge requests found
......@@ -92,7 +92,17 @@ class User < ApplicationRecord
end
def name_chunk
name[0...3].downcase
charset = ("a".."z").to_a - %w(b i l o s) + ("2".."9").to_a - %w(5 8)
chunk = name.parameterize[0...3]
if chunk.empty?
chunk + (0...3).map { charset.to_a[rand(charset.size)] }.join
elsif chunk.length == 1
chunk + (0...2).map { charset.to_a[rand(charset.size)] }.join
elsif chunk.length == 2
chunk + (0...1).map { charset.to_a[rand(charset.size)] }.join
else
chunk
end
end
def greenlight_account?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment