Browse Source

fix user login

pull/5/head
Aaron Parecki 9 years ago
parent
commit
4650ddc010
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      compass/app/Http/Controllers/IndieAuth.php

+ 6
- 5
compass/app/Http/Controllers/IndieAuth.php View File

@ -169,11 +169,12 @@ class IndieAuth extends BaseController
DB::update('UPDATE users SET last_login = ?', [date('Y-m-d H:i:s')]); DB::update('UPDATE users SET last_login = ?', [date('Y-m-d H:i:s')]);
session(['user_id' => $user->id]); session(['user_id' => $user->id]);
} else { } else {
DB::insert('INSERT INTO users (url, created_at, last_login) VALUES(?,?,?)', [$url, date('Y-m-d H:i:s'), date('Y-m-d H:i:s')]);
$user = DB::select('SELECT *
FROM users
WHERE url = ?', [$url]);
session(['user_id' => $user->id]);
$user_id = DB::table('users')->insertGetId([
'url' => $request->input('add_user'),
'created_at' => date('Y-m-d H:i:s'),
'last_login' => date('Y-m-d H:i:s'),
]);
session(['user_id' => $user_id]);
} }
} }

Loading…
Cancel
Save