10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/models/authic_user_mixin.rb', line 10
def find_for_authic_oauth(auth, signed_in_resource=nil)
user = User.where(:provider => auth.provider, :uid => auth.uid).first
user = User.new unless user
user.provider = auth.provider
user.uid = auth.uid
user.email = auth.info.email
user.first_name = auth.info.first_name
user.last_name = auth.info.last_name
user.middle_name = auth.info.middle_name
user.full_name = auth.info.full_name
user.mobile = auth.info.mobile
user.phone = auth.info.phone
user.birth_date = auth.info.birth_date
user.gender = auth.info.gender
user.timezone = auth.info.timezone
user.country = auth.info.country
user.address = auth.info.address
user.groups = (auth.info.groups.join(",") if auth.info.groups)
user.roles = (auth.info.roles.join(",") if auth.info.roles)
user.authic_data = (auth..raw_info.to_json.to_s if auth..raw_info)
user.save
return user
end
|