Skip to content

Commit d6ac876

Browse files
committed
Ensure user exists in database when authenticated.
1 parent 0e8d72f commit d6ac876

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/User.php

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public static function getCurrentUser() {
5757
cas()->isAuthenticated(); // XXX workaround CAS_OutOfSequenceBeforeAuthenticationCallException (because I don't know how to use Laravel properly)
5858
$username = cas()->getCurrentUser();
5959
$user = User::where('name', $username)->first();
60+
if ($user == null) {
61+
$user = User::create_if_absent($username);
62+
}
6063
return $user;
6164
}
6265

0 commit comments

Comments
 (0)