Skip to content

Commit

Permalink
Merge pull request apiato#137 from llstarscreamll/master
Browse files Browse the repository at this point in the history
Fix WEB login
  • Loading branch information
Mahmoudz authored Apr 21, 2017
2 parents cbc9503 + c1accda commit 9a5d363
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WebAdminLoginAction extends Action
*/
public function run(Request $request)
{
$user = $this->call(WebLoginTask::class, [$request->email, $request->password, $request->remember_me]);
$user = $this->call(WebLoginTask::class, [$request->email, $request->password, $request->remember_me ?? false]);

if (!$user->hasAdminRole()) {
throw new UserNotAdminException();
Expand Down
12 changes: 8 additions & 4 deletions app/Containers/Authentication/Tasks/WebLoginTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace App\Containers\Authentication\Tasks;

use App\Containers\Authentication\Exceptions\AuthenticationFailedException;
use App\Containers\Authentication\Exceptions\LoginFailedException;
use App\Ship\Parents\Tasks\Task;
use Auth;

/**
* Class WebLoginTask.
Expand All @@ -19,10 +20,13 @@ class WebLoginTask extends Task
*
* @return mixed
*/
public function run($email, $password, $remember = false)
public function run($email, $password, bool $remember = false)
{
// TODO:..
dump('incomplete..');
if (!$user = Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
throw new LoginFailedException();
}

return Auth::user();
}

}
2 changes: 1 addition & 1 deletion app/Containers/Authentication/UI/WEB/Views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<div class="login-page">
<h1 class="center">Login</h1>
<div class="form">
<form class="login-form" action="{{route('admin_login')}}" method="post">
<form class="login-form" action="{{route('post_admin_login_form')}}" method="post">
{{ csrf_field() }}
@if(session('status'))
<div class="text-red">{{ session('status') }}</div>
Expand Down

0 comments on commit 9a5d363

Please sign in to comment.