Update AuthLogin listener

This commit is contained in:
Daniel Supernault 2019-06-16 16:12:39 -06:00
parent 9cf2365edd
commit 49d60edac9
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -41,7 +41,7 @@ class AuthLogin
protected function userProfile($user) protected function userProfile($user)
{ {
if (empty($user->profile)) { if (empty($user->profile)) {
$profile = DB::transaction(function() use($user) { DB::transaction(function() use($user) {
$profile = new Profile(); $profile = new Profile();
$profile->user_id = $user->id; $profile->user_id = $user->id;
$profile->username = $user->username; $profile->username = $user->username;
@ -59,12 +59,6 @@ class AuthLogin
$profile->private_key = $pki_private; $profile->private_key = $pki_private;
$profile->public_key = $pki_public; $profile->public_key = $pki_public;
$profile->save(); $profile->save();
return $profile;
});
DB::transaction(function() use($user, $profile) {
$user = User::findOrFail($user->id);
$user->profile_id = $profile->id;
$user->save();
CreateAvatar::dispatch($profile); CreateAvatar::dispatch($profile);
}); });