userstyles.world icon indicating copy to clipboard operation
userstyles.world copied to clipboard

Add support for well-known URI "change-password"

Open mxdanger opened this issue 1 year ago • 5 comments

Describe the change you'd like: This should be quite a simple change. Redirect /.well-known/change-password to /account#password. This is just a quality-of-life improvement that makes changing your password a little easier.

Additional context:

mxdanger avatar Sep 06 '22 21:09 mxdanger

@vednoc Should we handle these URLs on Nginx. I don't think we want to implement this on the server.

Gusted avatar Sep 07 '22 18:09 Gusted

Done. Try it out: https://userstyles.world/.well-known/change-password

vednoc avatar Sep 07 '22 21:09 vednoc

So, I tried it out and I noticed some strange things:

  • If I was logged out and used the shortcut it takes me to /login?r=%2Faccount#password and after logging in it takes me to the account page but the section header #password is discarded so you have to scroll down to get to the password section.
  • However even if I'm already logged in it still takes me to the login url as described above when it should just take me right to /account#password.

mxdanger avatar Sep 07 '22 23:09 mxdanger

Ah! I just assumed it would work and went to bed. Thank you so much for testing it.

  1. We should use new URLSearchParams(location.search + location.hash).get('r') in login.ts file. Maybe there's a better way to do it.
  2. That could be because of CSP rules. @Gusted, is that correct?

vednoc avatar Sep 08 '22 19:09 vednoc

Figured it out! The second point is because of SameSite attribute of our cookie, not CSP rules. Here's a relevant read: https://web.dev/samesite-cookies-explained I'll deploy changes to production later.

vednoc avatar Sep 09 '22 00:09 vednoc