From fd038a3e44f5423c5bca7f1a81a24abdc28f6386 Mon Sep 17 00:00:00 2001 From: Sidharth Bansal Date: Wed, 11 Jul 2018 01:33:28 +0530 Subject: [PATCH] Password changed (#3031) * Password changed * Added space --- app/models/user.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 72d65071430..fde15c9fb2b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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