Password hashing and database
Your code is secure against SQL injection but it's largely inefficient. And this army of bindParams's takes the largest part in it. All you need is just to send an array you already have directly into execute():

$stmt-&gt;execute($data);


Registration

On the other hand, your use of try and catch operator for insert is proper, which is a rare sight. The only objection is error messages that shouldn't be bluntly echoed out. Better to collect them and show nicely along with a form. So I would make the whole registration code as

$error = '';
$data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
try {
    $stmt = $dbh-&gt;prepare("INSERT INTO `accounts` (`account_id`, `firstname`, `lastname`, `username`, `password`, `email`, `city`, `postalcode`, `adress`, `country`, `role`)
      VALUES (NULL, :firstname, :lastname, :username, :password, :email, :city, :postalcode, :adress, :country, 0) ");
    $stmt-&gt;execute($data);
} catch (PDOException $e) {
    if (strpos($e-&gt;getMessage(), "for key 'login'")) {
        $error =  'Duplicate login entry';
    } elseif (strpos($e-&gt;getMessage(), "for key 'email'")) {
        $error = 'Duplicate e-mail entry';
    } else {
        throw $e;
    }
}
if ($error) {
    echo $error;
} else {
    header("Location: ...");
    exit;
}  


Login

The login code could be improved as well. I've got a ready made example, Authenticating a user using PDO and password_verify(), you may check it out for the actual code. Here I will just comment on some parts

} catch (PDOException $e) {
    throw $e;
}


I fancy you just copy-pasted this part from the insert example. But if you think on it, it will become clear that this code will behave exactly the same without try, catch and throw operators! So they should be simple taken out. 

$rows = $stmt-&gt;rowCount();


is essentially useless, as you have the fetch result that can be used instead.

$result = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);


fetchAll() doesn't seem to be a wise choice, as it adds unnecessary dimension to the resulting array. fetch() should be used instead.