hidroh / materialistic

A material-design Hacker News Android reader
https://play.google.com/store/apps/details?id=io.github.hidroh.materialistic
Apache License 2.0
2.3k stars 509 forks source link

Successfully login with a Username with an extra blank but fail to merge the same accout and update the profile #1472

Open XixianLiang opened 8 months ago

XixianLiang commented 8 months ago

Bug symptom and steps to reproduce

There are 2 bugs in this issue.

Here are the steps to reproduce the bugs:

  1. Create an account. (e.g. username="user")
  2. Login the account and arbitrarily leave a comment.
  3. Go to "My profile" and you can see the posted comment. Login your account on Hacker News website and you can also see the comment.
  4. Logout the account. Then login the account with an extra blank in the front or back of the username. (e.g. username="user ")
  5. You can successfully login. Now arbitrarily leave a comment. Refresh the Hacker News website and you can see your new comment, which hints that you login the same account.
  6. Checkout "My profile" and it's empty. You can't update your profile.
  7. Checkout "Choose an account" function. There're two accounts here now (But they are the same account). There supposed to be only one here.

image

app version: v3.3 (apk 79) device: HUAWEI AGT-AN00 OS: MagicOS 7.0

Possible root cause

This might be a functional bug introduced by the fix of Issue #755. In Issue #755, user supposed to add a trim method in the login function to trim the extra blank automatically added by some keyboard when typing username, which is supposed to enhance user experience. So, the fix of Issue #775 added a trim method in the login function. But there was no additional handle for the select account function and profile function.