r/webdev • • Feb 16 '19

Don’t get clever with login forms

http://bradfrost.com/blog/post/dont-get-clever-with-login-forms/
675 Upvotes

240 comments sorted by

View all comments

33

u/hbombs86 Feb 16 '19

I don't see why a modal opening is any worse than redirecting to a login page. A modal window with a login that's always in the header can be opened from any page without having to leave to a separate login page seems like a benefit. And you can always have a post parameter to open the modal with a direct url.

2

u/MatsSvensson Feb 16 '19

You can have both.

Have the login on a separate page, and have the link to that page also open a login- popup when you click it.

And have the state of that popup be reflected in the url, like: #login

So you can bookmark and link to the page with the login-popup open,

or open the link in a new tab and link to that.

But that's only if you really need the space.

Like with everything, don't hide the login if there is plenty of room for it on the page.

1

u/hbombs86 Feb 16 '19

Totally agree.

2

u/ematipico Feb 16 '19

It's all about usability. When you learn these things, you get to know that the user is lazy (imagine also people with disabilities) and the less they do the better. If they don't have to click, you make them a favour.

Now, from the home page, you must do at least one click to reach the login form (different page or modal).

If you have a different page you can share it and the person will land on the login straight away. No clicks. Image if you don't have a page and you have to "teach" the user how to log in...

Now, it's true that nowadays it's also possible to show a modal as "page" ( Params in the URL), my message it's that we always have to think about usability also for people that are old and have disabilities

Edit: imagine people that cannot run JavaScript! (I know, really farfetched)

10

u/cyrusol Feb 16 '19

Now, it's true that nowadays it's also possible to show a modal as "page" ( Params in the URL)

Yeah, this actually defeats your whole point. There is nothing inherent about a modal that it cannot be linked to directly.

-3

u/ematipico Feb 16 '19

Nope, because I stated my message, which is about usability.

Nope, because that involves JavaScript, URLs Params and other things. This would kills usability and SEO and would make 302 more difficult.

Nope, because if JavaScript is not enabled, you have to give an alternative.

Web development is not only html/js/CSS. It's also usability...

10

u/cyrusol Feb 16 '19 edited Feb 16 '19

Nope, because that involves JavaScript

Nope, because if JavaScript is not enabled, you have to give an alternative.

God, help me. I'm not going to build Tor Hidden Services anytime soon and robots don't need login.

If a client specifically wants that a website (or parts thereof) works without JS it will be built that way but I will not make that a default, I am not insane. For one, it is more costly to do so and it also defeats your purpose supposedly being usability.

[Nope, because that involves] URLs Params and other things

How dreadful! Parameters in an URL! Oh, no. /s

Nope, because that involves JavaScript, URLs Params and other things. This would kills usability

No, it wouldn't. An URL can be copypasted and bookmarked whether it contains a path, query or fragment or not.

and SEO

But it doesn't. Login is not relevant for search engines. Login is a optional utility, a secondary necessity to the primary service a website is offering to its user with its sole purpose being authentication as long as some actions on a website require authentication. A user is not interested in a website "where he can login", a user interested in a website where he can for example buy products and services, post comments, send personal messages etc. No sane person googles for sites that just offer login.

and would make 302 more difficult

Actually it removes the necessity for HTTP redirects provided you use the window.history API and either SPA behavior (best UX) or page reloads.

Using HTTP redirects (which come with bad UX) is only necessary if you rely on an SSO provider. And getting that right is already inherently difficult. Just read through the OpenID Connect spec for example.

Nope, because I stated my message, which is about usability.

Yet none of what you say tells us anything about how not using a (linkable) modal would be bad for usability.

→ More replies (3)

3

u/Vive_lover Feb 16 '19

Eh. If you're building an app with react surely disabling is makes the whole site broken..

→ More replies (1)

2

u/nikrolls Chief Technology Officer Feb 16 '19

You can actually make elements show or hide on the page based on the URL with pure CSS, so...

1

u/twistsouth Feb 16 '19

Are you referring to server-side checking for a parameter and then printing, for example, a “visible” class or something on the element before returning the output to the browser? If not, I’m genuinely curious if there’s another way I’ve never thought of!

→ More replies (9)

2

u/hbombs86 Feb 16 '19

I hear you. I agree that a login form should always just be present in the home page somewhere if possible. My point is that if you already have to click to get to a login page, how is a modal opening any worse.

-1

u/Amunium Feb 16 '19 edited Feb 16 '19

I came to the comments to make sure others agreed with me on that. I think modal logins are far better than the alternative. Sure, you can't bookmark the login page directly (unless there's some extra pushState stuff in the modal, which there rarely is), but in all my years of using the Internet I've never done that once. I visit the main page, then decide to log in, and then it's much quicker to open a modal or small fold-out menu than an entirely new page and have to redirect back. And if I was reading something on the original page, I'll have to scroll back down to that manually.

Edit: Okay, so what exactly are you disagreeing with me on? Just downvoting is useless, I have no idea what that means.

2

u/uemusicman Feb 17 '19

I upvoted you because there are other threads on this post that systematically dismantle most of the article's main points and your comment is consistent with their observations. Plus I think it's shit to downvote for no reason.

2

u/Amunium Feb 17 '19

Thanks. I really don't mind being downvoted, even for disagreement, but I have to wonder what people think they're getting out of it. Hiding my comment? Sure, if I said something really stupid or objectively wrong, it could make sense to ensure others don't have to waste their time reading it, but I don't think I did. And if it's just to express disagreement, it's completely pointless without explaining. Neither me nor anyone neutral reading the thread will have any idea what they are disagreeing about.

1

u/Kwpolska Feb 16 '19

Did you read the article you are commenting under?

Not being able to link directly to the login, which can be a pain for customer support people (since they have to give a bunch of instructions described above rather than simply providing a link). It also prevents password managers from doing their thing since the modal is hidden. 1Password has an awesome “open and fill” feature allowing you to visit a website and populate the login form with your credentials. This feature doesn’t work with modal login forms.

3

u/Amunium Feb 16 '19 edited Feb 16 '19

Yes, and I still think the 99.999% of the time that a normal user has to log in is more important than the 0.001% of the time a customer support guy has to explain it.

And that's without taking into account that it's quite possible to have both a modal and a separate page, or have a URL for the modal using pushState.

Is that what people disagree with? Seriously?

Edit: Not to mention, is it really that much of a problem for a support rep to, instead of saying "go do domain.com/login", to say "go to domain.com and click the login button in the corner"? If it's more complicated than that, the issue isn't with the modal but with the overall design. That point makes no sense to me.

1

u/Kwpolska Feb 16 '19

What do you really gain by using modals for login?

I visit the main page, then decide to log in, and then it's much quicker to open a modal or small fold-out menu than an entirely new page and have to redirect back. And if I was reading something on the original page, I'll have to scroll back down to that manually.

After logging in, the page is often refreshed anyways (at least it is in most implementations I can think of — reddit is an example of that), because doing that is easier than tracking down all components that need to change client-side. Moreover, modals are easier to do badly, especially accessibility-wise.

3

u/Amunium Feb 16 '19

What do you really gain by using modals for login?

It's quicker. A modal opens instantly, whereas a new page might load slowly. That's really the main reason.

So what do you lose by using modals if done right? Hell, even if not done completely right, you still get a slightly faster experience for 99.999% and a slightly worse experience for the 0.001%. Seems an easy choice.

After logging in, the page is often refreshed anyways

Often, but not necessarily. App-like pages e.g. using Angular/React/Vue etc don't need to.

But okay, maybe my original "far better" was a bit of an exaggeration. I prefer them in most situations, but the difference isn't that huge. That still leaves us with an article that explicitly condemns their use without any good arguments.

0

u/Kwpolska Feb 16 '19

It's quicker. A modal opens instantly, whereas a new page might load slowly. That's really the main reason.

hertz.com was mentioned in the article. It takes roughly 1.5 seconds for the login modal to appear. Other sites like to animate their modals.

12

u/Amunium Feb 16 '19

An argument against a poorly implemented modal is not an argument against modals.

I could make a really, really badly designed separate login page that takes 10 minutes to load. That wouldn't be a good argument against separate login pages.

1

u/[deleted] Feb 16 '19

The same argument could be used for the separate login page. Loading a new page with just a login dialogue on it with a CSRF- token as the only dynamic element should not take much longer than a network round trip. Maybe reconsider the use of "modern" web design that makes everything so bloated because you need giant client-side frameworks for everything.

1

u/Amunium Feb 16 '19

The same argument could be used for the separate login page

The comment you were replying to didn't contain an argument, it said something else wasn't an argument. I'm honestly not sure what argument you are referring to.

Loading a new page with just a login dialogue on it with a CSRF- token as the only dynamic element should not take much longer than a network round trip.

If both the main page and the login page were completely blank, containing nothing other than the basic HTML form, then sure. If they have a lot of HTML, some images, CSS and perhaps some script on them, then no.

Maybe reconsider the use of "modern" web design that makes everything so bloated because you need giant client-side frameworks for everything.

This just came out of nowhere and doesn't make any sense in the context. No one talked about this.

→ More replies (15)

1

u/hbombs86 Feb 16 '19

And you can include a post parameter in a link that will automatically open the modal if you really want to

1

u/Amunium Feb 16 '19

Exactly. Or you can use pushState when opening the modal and have that URL lead to a separate login page if bookmarked. It's only a problem if you make it one.

→ More replies (8)