Do not trust v-model in login input, for password manager's autofill #2972

Open
xnuk wants to merge 1 commit from gitlab-mr-iid-1705 into develop
Member

Changes

  • Make login successful after password manager (specifically Keepass Tusk) autofills.
    • Previously it sent {username: undefined, password: undefined} to the backend, even if it's filled.

The v-model is not updated after the autofill somehow. Instead of adding more listener like onchange, this tries to don't rely on v-model and get username and password from $refs.

# Changes * Make login successful after password manager (specifically [Keepass Tusk]) autofills. * Previously it sent `{username: undefined, password: undefined}` to the backend, even if it's filled. The `v-model` is not updated after the autofill somehow. Instead of adding more listener like `onchange`, this tries to don't rely on `v-model` and get `username` and `password` from `$refs`. [Keepass Tusk]: https://github.com/subdavis/tusk

I wonder if this is related to the issue in #2806/diffs

I wonder if this is related to the issue in https://git.pleroma.social/pleroma/pleroma-fe/pulls/2806/diffs
Owner

I can say that it doesn't affect me with KeePassXC-Browser at least, not sure if this necessary since Keepass Tusk seems to be obsolete/deprecated.

I can say that it doesn't affect me with KeePassXC-Browser at least, not sure if this necessary since Keepass Tusk seems to be obsolete/deprecated.
Owner

in general i would prefer if extensions fixed their issues themselves, as we can't possibly keep up with whatever hacks they are coming up with.

in general i would prefer if extensions fixed their issues themselves, as we can't possibly keep up with whatever hacks they are coming up with.
Author
Member

Doing this in the console:

document.getElementById('username').value = 'username here'
document.getElementById('password').value = 'password here'
document.querySelector('form.login-form button[type=submit]').click()

makes send this request, both "username" and "password" are undefined:

POST /oauth/token
-----------------------------15028169781311006156611277227
Content-Disposition: form-data; name="client_id"

[REDACTED]
-----------------------------15028169781311006156611277227
Content-Disposition: form-data; name="client_secret"

[REDACTED]
-----------------------------15028169781311006156611277227
Content-Disposition: form-data; name="grant_type"

password
-----------------------------15028169781311006156611277227
Content-Disposition: form-data; name="username"

undefined
-----------------------------15028169781311006156611277227
Content-Disposition: form-data; name="password"

undefined
-----------------------------15028169781311006156611277227--

I don't think Keepass Tusk has a problem, it looks okay to me: https://github.com/subdavis/Tusk/blob/develop/background/inject.js#L168-L191

Doing this in the console: ```js document.getElementById('username').value = 'username here' document.getElementById('password').value = 'password here' document.querySelector('form.login-form button[type=submit]').click() ``` makes send this request, both "username" and "password" are undefined: ``` POST /oauth/token -----------------------------15028169781311006156611277227 Content-Disposition: form-data; name="client_id" [REDACTED] -----------------------------15028169781311006156611277227 Content-Disposition: form-data; name="client_secret" [REDACTED] -----------------------------15028169781311006156611277227 Content-Disposition: form-data; name="grant_type" password -----------------------------15028169781311006156611277227 Content-Disposition: form-data; name="username" undefined -----------------------------15028169781311006156611277227 Content-Disposition: form-data; name="password" undefined -----------------------------15028169781311006156611277227-- ``` I don't think Keepass Tusk has a problem, it looks okay to me: https://github.com/subdavis/Tusk/blob/develop/background/inject.js#L168-L191
Author
Member

Maybe off-topic: Although Keepass Tusk is deprecated, I'm still using Tusk because I have a problem to connecting between Keepass client and browser extension like KeepassXC-Browser, every time I tried.

Maybe off-topic: Although Keepass Tusk is deprecated, I'm still using Tusk because I have a problem to connecting between Keepass client and browser extension like KeepassXC-Browser, every time I tried.
This pull request has changes conflicting with the target branch.
  • src/components/login_form/login_form.js
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin gitlab-mr-iid-1705:gitlab-mr-iid-1705
git switch gitlab-mr-iid-1705

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch develop
git merge --no-ff gitlab-mr-iid-1705
git switch gitlab-mr-iid-1705
git rebase develop
git switch develop
git merge --ff-only gitlab-mr-iid-1705
git switch gitlab-mr-iid-1705
git rebase develop
git switch develop
git merge --no-ff gitlab-mr-iid-1705
git switch develop
git merge --squash gitlab-mr-iid-1705
git switch develop
git merge --ff-only gitlab-mr-iid-1705
git switch develop
git merge gitlab-mr-iid-1705
git push origin develop
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pleroma/pleroma-fe!2972
No description provided.