how to login via devtools #298

Closed
opened 2026-02-04 18:26:50 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @kekkodance on GitHub (Mar 15, 2023).

how would i insert login details via devtools? is there a login function i can just supply with a username and password?

Originally created by @kekkodance on GitHub (Mar 15, 2023). how would i insert login details via devtools? is there a login function i can just supply with a username and password?
Author
Owner

@meltyshev commented on GitHub (Apr 3, 2023):

Hi! Sorry for the late reply. There is no such function, but you can do something like this:

function setReactInputValue(input, value) {
  const previousValue = input.value;

  // eslint-disable-next-line no-param-reassign
  input.value = value;

  const tracker = input._valueTracker;
  if (tracker) {
    tracker.setValue(previousValue);
  }

  // 'change' instead of 'input', see https://github.com/facebook/react/issues/11488#issuecomment-381590324
  input.dispatchEvent(new Event('change', { bubbles: true }));
}

const emailOrUsernameInput = document.querySelector('[name="emailOrUsername"]');
setReactInputValue(emailOrUsernameInput, 'EMAIL_OR_USERNAME_HERE')

const passwordInput = document.querySelector('[name="password"]');
setReactInputValue(passwordInput, 'PASSWORD_HERE');

document.querySelector('button').click();
@meltyshev commented on GitHub (Apr 3, 2023): Hi! Sorry for the late reply. There is no such function, but you can do something like this: ``` function setReactInputValue(input, value) { const previousValue = input.value; // eslint-disable-next-line no-param-reassign input.value = value; const tracker = input._valueTracker; if (tracker) { tracker.setValue(previousValue); } // 'change' instead of 'input', see https://github.com/facebook/react/issues/11488#issuecomment-381590324 input.dispatchEvent(new Event('change', { bubbles: true })); } const emailOrUsernameInput = document.querySelector('[name="emailOrUsername"]'); setReactInputValue(emailOrUsernameInput, 'EMAIL_OR_USERNAME_HERE') const passwordInput = document.querySelector('[name="password"]'); setReactInputValue(passwordInput, 'PASSWORD_HERE'); document.querySelector('button').click(); ```
Author
Owner

@kekkodance commented on GitHub (Apr 4, 2023):

thank you!

@kekkodance commented on GitHub (Apr 4, 2023): thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#298