Added condition when login invalid
This commit is contained in:
parent
71fb5e4933
commit
a34ce9d0eb
@ -16,7 +16,6 @@ class Home
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
// echo "This is index of home"; // Nanti di replace sama twig view ke App\Views\Data\pengumuman.html
|
||||
$posts = new Posts();
|
||||
$posts->index();
|
||||
return true;
|
||||
@ -24,23 +23,23 @@ class Home
|
||||
|
||||
public function login()
|
||||
{
|
||||
// echo "You have to login"; // Nanti di replace sama twig view ke App\Views\Access\login.html
|
||||
View::render('Access/login.html', [
|
||||
'token' => Token::generate()
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Methods
|
||||
public function put($args = [])
|
||||
{
|
||||
if ($this->access->login($args)) {
|
||||
$table = 'user';
|
||||
$id = Session::get('userid');
|
||||
if ($this->access->update($table, ['status' => 1], $id)) {
|
||||
|
||||
$this->access->update($table, ['status' => 1], $id);
|
||||
}
|
||||
Redirect::to('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ class Access extends \Core\Model
|
||||
'salt char(23) NOT NULL',
|
||||
'name varchar(50) NOT NULL',
|
||||
'registered_at date NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||
'status tinyint NOT NULL DEFAULT 1',
|
||||
'status tinyint NOT NULL DEFAULT 0',
|
||||
'PRIMARY KEY (id)'
|
||||
]
|
||||
);
|
||||
@ -94,6 +94,7 @@ class Access extends \Core\Model
|
||||
}
|
||||
}
|
||||
}
|
||||
\Core\Session::flash('info', 'Invalid username/password');
|
||||
return false;
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
|
Loading…
Reference in New Issue
Block a user