Skip to content

Commit

Permalink
Password changed (publiclab#3031)
Browse files Browse the repository at this point in the history
* Password changed

* Added space
  • Loading branch information
SidharthBansal authored and jywarren committed Jul 10, 2018
1 parent 9f9264d commit fd038a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,12 @@ def self.create_with_omniauth(auth)
charset = Array('A'..'Z') + Array('a'..'z') + Array(0..9)
email_prefix = auth["info"]["email"].tr('.', '_').split('@')[0]
email_prefix = auth["info"]["email"].tr('.', '_').split('@')[0] + Array.new(2) { charset.sample }.join until User.where(username: email_prefix).empty?
puts(auth)
create! do |user|
s = SecureRandom.random_bytes(32)
user.username = email_prefix
user.email = auth["info"]["email"]
user.password = auth["uid"]
user.password_confirmation = auth["uid"]
user.password = s
user.password_confirmation = s
user.save!
end
end
Expand Down

0 comments on commit fd038a3

Please sign in to comment.