diff --git a/include/class.auth.php b/include/class.auth.php
index ccf352b9d7996b499190d64cf0328abc80347e35..d326ce685348f617b95854ca15a77eb43de89053 100644
--- a/include/class.auth.php
+++ b/include/class.auth.php
@@ -805,35 +805,24 @@ class osTicketClientAuthentication extends UserAuthenticationBackend {
     static $id = "client";
 
     function authenticate($username, $password) {
-        if (!($user = self::_identify($authkey)))
+        if (!($acct = ClientAccount::lookupByUsername($username)))
             return;
 
-        if (($client = new ClientSession(new EndUser($user)))
+        if (($client = new ClientSession(new EndUser($acct->getUser())))
             && $client->getId()
-            && ($acct = $client->getAccount())
             && $acct->checkPassword($password)
         ) {
             return $client;
         }
     }
 
-    protected function validate($authkey) {
-        if (!($user = self::_identify($authkey)))
+    protected function validate($username) {
+        if (!($acct = ClientAccount::lookupByUsername($username)))
             return;
 
-        if (($client = new ClientSession(new EndUser($user))) && $client->getId())
+        if (($client = new ClientSession(new EndUser($acct->getUser()))) && $client->getId())
             return $client;
     }
-
-    protected function _identify($username) {
-        if (strpos($authkey, '@') !== false)
-            $user = User::lookup(array('emails__address'=>$authkey));
-        else
-            $user = User::lookup(array('account__username'=>$authkey));
-
-        return $user;
-    }
-
 }
 UserAuthenticationBackend::register('osTicketClientAuthentication');
 
diff --git a/include/client/login.inc.php b/include/client/login.inc.php
index 9ed334e951094f02cb173fec38fa7106b1e2a728..9dc62eb571dc0ed81e380f87d516a4f47a995d2c 100644
--- a/include/client/login.inc.php
+++ b/include/client/login.inc.php
@@ -7,6 +7,7 @@ $passwd=Format::input($_POST['lpasswd']?:$_GET['t']);
 <h1>Sign In</h1>
 <form action="login.php" method="post" id="clientLogin">
     <?php csrf_token(); ?>
+    <div style="width:50%;display:inline-block">
     <strong><?php echo Format::htmlchars($errors['login']); ?></strong>
     <br>
     <div>
@@ -20,6 +21,7 @@ $passwd=Format::input($_POST['lpasswd']?:$_GET['t']);
     <p>
         <input class="btn" type="submit" value="Sign In">
     </p>
+</div>
 </form>
 <br>
 <p>