Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Login & Password Managers / Auto complete #152

Open
dinkelstefan opened this issue May 15, 2024 · 6 comments
Open

Support Login & Password Managers / Auto complete #152

dinkelstefan opened this issue May 15, 2024 · 6 comments

Comments

@dinkelstefan
Copy link

The plugin is great for supporting browser password saving, but when saving passwords only the password is saved without the username.
This is because it only keeps one HTML<input> active at the same time.

image
image

Possible solution:

  • Option to create two extra static HTML<input> elements for username and password
  • Elements link to Unity InputFields with property in Inspector for WebGLInput
  • Elements always stay in background
    • Allows auto fill of username & password
    • Allows saving both username & password in password managers
  • These elements are used instead of the normal HTML<input> when selecting the linked Unity InputFields

Thank you for your work Kou-Yeung

@kou-yeung
Copy link
Owner

kou-yeung commented May 15, 2024

is very hard to support autocomplete.. ( I don't know much about it
i was search the sample code and read html reference.
username and password need
element inside at

and need submit func to save it.

so. i think you can create a custom form to overlay (default hidden) on canvas.
and when you want to login. set the overlay to show at screen.
and listen the submit function. when submit was called. get the text from overlay...( or redirect the result to your app

*I don't know if it will work well or not...

@dinkelstefan
Copy link
Author

dinkelstefan commented May 16, 2024

Thank you for your thoughts, for now saving the password is already great. I will try your idea when we experiment with password manager features in the future.

Maybe chrome will already save the username when I bind a type="email" for the username WebGLInput field

@kou-yeung
Copy link
Owner

kou-yeung commented May 16, 2024

now is pass the flag (bool) isPassword to javascript
( bool isPassword = input.contentType == ContentType.Password; )

maybe can conversion ContentType to string
like.

string ContentTypeToInputType(ContentType type)
{
    return type switch {
        ContentType.Password => "password",
        ContentType.EmailAddress => "email",
        _ => "text"
    };
}

and pass the string to javascript from WebGLInputPlugin.WebGLInputCreate(...)

memo:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input

@kou-yeung
Copy link
Owner

and edit WebGLInput.jslib code

if(isPassword){
    input.type = 'password';
}

↓ to
input.type = UTF8ToString(contentTypeString);

maybe work..haha

@kou-yeung
Copy link
Owner

I don't know if it will work well or not
but this change is not bad ^^

@kou-yeung
Copy link
Owner

tried. when set type to email
Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('email') does not support selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants