if a user is on my site's login page, he would have the keys to the secure connection
I don't know what you meant by that...
Client-side protection is more of a help than a protection. If a field on the form must be an email, a client-side email validation will help the user know that the email is invalid before sending the form, and having to probably fill the form all again, while saving on bandwidth and processing on the server-side. But it does not protect the application.
But nobody has to use the client. There are browsers that don't support Javascript (lynx, links, w3m, among others), there are clients that use HTTP libraries instead without any rendering, there are command-line HTTP clients (wget
, curl
, and PowerShell bindings too), and those "access methods" will not care about the scripts you put in place, or not even see them at all.
A user could just fire up openssl s_client -connect example.org 443
, for example, and type HTTP commands straight to the server. As HSTS is only a protection on the browser side, it means nothing here. And Javascript too, or maxlength
attribute on form fields, or anything you put in place.
So never trust the client, not even the protections you put on the client-side. It is a time-saving feature, not a protection. Protect the server-side, always.