/**
  * check administrator authentication
  * role: administrator
  */
 public function login()
 {
     if (Authenticate::is_authorized()) {
         transport("dashboard");
     } else {
         $model_administrator = new Authenticate();
         /*
          * populate login data for administrator
          * use setter method to registering information of authentication
          */
         $model_administrator->set_email($_POST['username']);
         $model_administrator->set_password($_POST['password']);
         $model_administrator->set_type(Authenticate::SUPERUSER);
         $login = $model_administrator->authenticate();
         /*
          * $login variable contain array which have 2 keys [granted] and [state]
          * granted {true|false} and state {active|pending}
          * just grant credential that return active and match email and password
          */
         if ($login["granted"] && $login["state"] == User::ACTIVE) {
             transport("dashboard");
         } else {
             $_SESSION['operation'] = 'error';
             $_SESSION['message'] = $login["state"];
             transport("administrator");
         }
     }
 }