public function updateLogin($type = null)
    {
        $this->authenticated_as      = $type;
        $this->authenticated_at      = setTime('now');
        $this->failed_login_attempts = 0;
        $this->save();
    }