Login
The user can have one of the three roles: Admin, Author and Member. As an Admin, the user can manage the blog, as an Author the user is able to manage the articles and as a member the user can comment. For all of these roles there are default credentials:
- [email protected], with the password secret
- [email protected], with the password secret
- [email protected], with the password secret
For logging in, the user can press the Laravel Login As button in the top navbar or by simply adding /login in the url.
The
App\Http\Controllers\Auth\LoginController
handles the user's authentication.
public function showLoginForm(Request $request)
{
$userName = '';
$userType = $request->input('role');
switch ($userType) {
case '1':
$userName = 'admin';
break;
case '2':
$userName = 'author';
break;
case '3':
$userName = 'member';
break;
default:
$userName = 'admin';
break;
}
return view('auth.login', compact(['userName', 'userType']));
}
There are validation rules in case of entering wrong data in the inputs. Also, according to its role, the user has access to pages and operations like deleting other users.