namespace BookStack\Http\Controllers\Auth;
+use BookStack\Exceptions\AuthException;
use BookStack\Http\Controllers\Controller;
use BookStack\Repos\UserRepo;
use BookStack\Services\SocialAuthService;
// Explicitly log them out for now if they do no exist.
if (!$user->exists) auth()->logout($user);
- if (!$user->exists && $user->email === null && !$request->has('email')) {
+ if (!$user->exists && $user->email === null && !$request->filled('email')) {
$request->flash();
session()->flash('request-email', true);
return redirect('/login');
}
- if (!$user->exists && $user->email === null && $request->has('email')) {
+ if (!$user->exists && $user->email === null && $request->filled('email')) {
$user->email = $request->get('email');
}
// Check for users with same email already
$alreadyUser = $user->newQuery()->where('email', '=', $user->email)->count() > 0;
if ($alreadyUser) {
- throw new AuthException('A user with the email ' . $user->email . ' already exists but with different credentials.');
+ throw new AuthException(trans('errors.error_user_exists_different_creds', ['email' => $user->email]));
}
$user->save();