Element-web: Validate phone number input locally

Created on 16 Apr 2017  ·  3Comments  ·  Source: vector-im/element-web

Description

My browser's autofill completed my username in the phone number box probably due to an older form's design. This was unfortunate and difficult to detect because the username obscured the text indicating the field was for phone numbers only. The error message for this scenario should probably be improved and the UI should probably prevent a user from entering a username in the phone number field.

Steps to reproduce

  1. Go to the login page
  2. Select America and enter your username in the mobile phone number field
  3. Enter your password
  4. Press the sign in button

Describe how what happens differs from what you expected.

  • The phone number field should probably not accept letters
  • The country field should be more clearly labeled to indicate that country refers to phone number origin, not server location preference
  • The user visible error response for entering an unexpected string for phone number should be more verbose than There was a problem logging in. (HTTP 400)

Log:

Successfully compiled asm.js code (total compilation time 38ms; unable to cache asm.js in synchronous scripts; try loading asm.js via <script async> or createElement('script'))  olm.js
"Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome."  bundle.js:81:17755
"Vector starting at https://riot.im/app/#/login"  bundle.js:81:17755
Restoring session for @208425:matrix.org  bundle.js:81:17755
setLoggedIn => @208425:matrix.org (guest=true) hs=https://matrix.org  bundle.js:81:17755
Session persisted for @208425:matrix.org  bundle.js:81:17755
newscreen login  bundle.js:81:17755
XML Parsing Error: syntax error
Location: https://riot.im/app/version?cachebuster=1492311939009
Line Number 1, Column 1:  version:1:1
newscreen login  bundle.js:81:17755
IndexedDB worker is ready  bundle.js:81:17755
sync(): not doing HTTP hit, instead returning stored /sync data  bundle.js:81:17755
MatrixClient sync state => PREPARED  bundle.js:81:17755
MatrixClient sync state => SYNCING  bundle.js:81:17755
Persisting sync data up to  s132585502_195301772_228608_21601373_217439_72048_713898_550862  indexeddb-worker.js:27:30272
"/sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=%7B%7D&timeout=30000&since=s132585502_195301772_228608_21601373_217439_72048_713898_550862&access_token=MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmcKMDAxM2lkZW50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDI1Y2lkIHVzZXJfaWQgPSBAMjA4NDI1Om1hdHJpeC5vcmcKMDAxNmNpZCB0eXBlID0gYWNjZXNzCjAwMjFjaWQgbm9uY2UgPSAuYkJ-RUR0RVk0M2Q4NEVuCjAwMTVjaWQgZ3Vlc3QgPSB0cnVlCjAwMmZzaWduYXR1cmUgD12BMRtOxLxg1v2gIn3xNmE8LI1LAHF95Cby2ScNuHUK"  bundle.js:81:17755
Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=%7B%7D&timeout=30000&since=s132585502_195301772_228608_21601373_217439_72048_713898_550862&access_token=MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmcKMDAxM2lkZW50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDI1Y2lkIHVzZXJfaWQgPSBAMjA4NDI1Om1hdHJpeC5vcmcKMDAxNmNpZCB0eXBlID0gYWNjZXNzCjAwMjFjaWQgbm9uY2UgPSAuYkJ-RUR0RVk0M2Q4NEVuCjAwMTVjaWQgZ3Vlc3QgPSB0cnVlCjAwMmZzaWduYXR1cmUgD12BMRtOxLxg1v2gIn3xNmE8LI1LAHF95Cby2ScNuHUK
Stack trace:
i@https://riot.im/app/bundles/2379a6d8501f4248496c/bundle.js:46:29865
r@https://riot.im/app/bundles/2379a6d8501f4248496c/bundle.js:46:29612
  bundle.js:81:17755
Number of consecutive failed sync requests: 1  bundle.js:81:17755
Starting keep-alive  bundle.js:81:17755
MatrixClient sync state => RECONNECTING  bundle.js:81:17755
MatrixClient sync state => SYNCING  bundle.js:81:17755
"/sync error Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=%7B%7D&timeout=30000&since=s132585551_195302203_228615_21601383_217439_72048_713898_550862&access_token=MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmcKMDAxM2lkZW50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDI1Y2lkIHVzZXJfaWQgPSBAMjA4NDI1Om1hdHJpeC5vcmcKMDAxNmNpZCB0eXBlID0gYWNjZXNzCjAwMjFjaWQgbm9uY2UgPSAuYkJ-RUR0RVk0M2Q4NEVuCjAwMTVjaWQgZ3Vlc3QgPSB0cnVlCjAwMmZzaWduYXR1cmUgD12BMRtOxLxg1v2gIn3xNmE8LI1LAHF95Cby2ScNuHUK"  bundle.js:81:17755
Error: CORS request rejected: https://matrix.org/_matrix/client/r0/sync?filter=%7B%7D&timeout=30000&since=s132585551_195302203_228615_21601383_217439_72048_713898_550862&access_token=MDAxOGxvY2F0aW9uIG1hdHJpeC5vcmcKMDAxM2lkZW50aWZpZXIga2V5CjAwMTBjaWQgZ2VuID0gMQowMDI1Y2lkIHVzZXJfaWQgPSBAMjA4NDI1Om1hdHJpeC5vcmcKMDAxNmNpZCB0eXBlID0gYWNjZXNzCjAwMjFjaWQgbm9uY2UgPSAuYkJ-RUR0RVk0M2Q4NEVuCjAwMTVjaWQgZ3Vlc3QgPSB0cnVlCjAwMmZzaWduYXR1cmUgD12BMRtOxLxg1v2gIn3xNmE8LI1LAHF95Cby2ScNuHUK
Stack trace:
i@https://riot.im/app/bundles/2379a6d8501f4248496c/bundle.js:46:29865
r@https://riot.im/app/bundles/2379a6d8501f4248496c/bundle.js:46:29612
  bundle.js:81:17755
Number of consecutive failed sync requests: 1  bundle.js:81:17755
Starting keep-alive  bundle.js:81:17755
MatrixClient sync state => RECONNECTING  bundle.js:81:17755
MatrixClient sync state => SYNCING  bundle.js:81:17755

screenshot from 2017-04-15 21-14-10

Version information

  • Platform: web
  • Browser: Chromium v57.0.2987.98, Firefox v52.0.1
  • OS: Ubuntu v17.04
  • URL: riot.im/app
bug p1 minor uux

All 3 comments

This is particularly an issue when the browser tries to be helpful and puts your saved username in the phone field.

We're doing some work to improve the usability of the country dropdown; its purpose should be clearer after that (either in #3524 or #3526).

The browser autofilling into fields which are only labelled by their placeholder text is an interesting one:

  • we should be cognisant of autofill when changing our forms
  • perhaps we shouldn't rely on placeholder for labelling (this is ripe for bikeshedding)

Something that is unambiguous and immediately actionable is to improve the error message - at the very least you should get a "That's an invalid X" when submitting an identifier that doesn't match the prescribed format.

Even better would be for the form to provide said feedback before submission. I _thought_ we had some designed mockups of what these should look like somewhere...

Actually, this isn't fixed.

The phone number field should probably not accept letters

@lampholder I feel like this has not a lot to do with the country drop-down (especially since the most recent changes that landed for it).

I think this is more along the lines of "Why are we allowing phone numbers with letters in them?".

Was this page helpful?
0 / 5 - 0 ratings