Javascript - Masking a password on a JS alert box - javascript

I have the following
var validate=prompt("Enter your PIN","Enter your PIN");
This works fine except it shows the password when typing it.
Is there any way to mask the password being entered?
Cheers,

Nope, there is no way to mask prompt box. You will have to use some other custom solution or use password input box instead.
If you want to do validation of password, do it on the server-side not client-side.

If you really want a prompt window and accept a password, you might want to use this plugin along with jquery. Check out example 9 on http://trentrichardson.com/Impromptu/index.php and use type="password" instead.

It's impossible to hide the password.JS load on the client side.
We can easily find the password by checking the source code.
Here is an example. Check it out yourself
http://www.pageresource.com/jscript/jpass.htm

Related

Autocomplete navigator chrome firefox edge

I have a form and there are two fields that chrome autocompletes. These fields are the email and the password.
I don't want it to autocomplete, and I've tried this:
autocomplete="off"
This works for fields that are of type text, like name. This one with that characteristic no longer reminds me.
But the password even with that keeps reminding me.
I have investigated changing the name and the ID and nothing keeps reminding me.
Until I have removed the typo and put text on it. Now it doesn't remind me or autocomplete it. But of course I can't let users enter passwords and see them.
I have tried with js to put the type text and when the user clicks on it (onFucus) it will change it to type password. But of course when the user clicks, I get a password type and now the browsers remind me of the passwords again.
My question is this:
I can put this text type input but every time the user writes, asterisks appear.
Set autocomplete to false in your form's opening tag -> <form autocomplete="false">. False works cross-browser, and you can see an explanation as to why here: Autocomplete off vs false?
In the end, to solve this problem, I changed the input type to text. With that it no longer tells me the passwords.
But how to solve the problem that passwords are seen?
Very simple, a font has been created that is all circles imitating passwords.

How could the programe locate the input-box of user-name and password on the html page exactly?

I'm trying to implement an function that auto-fill form(maybe,some page just input-box and submit button) with python and selenium.
It is similar to browser's auto-fill form: parsing the web page, locate input-box of user-name and password on a page, and auto fill them next time.
The problem is about how to locate the username input box or password input.
I look for a way which could handle most of page,but encountered several problems:
The user name and password of some pages are not in the form label;
There are not only user name and password entry box, but also have the verification code input box;
The name of input-box not only as "username" or "password".It maybe another word.So I can not judge by name of the username input box or password input box.
Some methods have been tried, such as:
Password input box with password attribute;
The user name input box is near the password input box;
But the effect is not ideal.
Is there any good method or suggestion? How does the browser do it?
Here its something difficult to answer your question because you do not mention any reference anyway I am giving your 2 example image where you can find the most efficient way to find XPath
Hope it will help you to find your Right XPath
There is no way to generalize a way to automate all web pages as far as I know,as elements in DOM vary in each and every page and so you need to change in xpath locator accordingly.I know its tiresome! uff..:-(
However do have a look into Sikuli and see if this can serve your needs.
Brief overview of Sikuli mentioned in their site:
Sikuli automates anything you see on the screen. It uses image
recognition to identify and control GUI components. It is useful when
there is no easy access to a GUI's internal or source code.
More info:
http://www.sikuli.org/

how to password protect any field in form (wants suggestions)

Here I want to create one field(select box- dropdown) in form which is password protected.
when user click on that dropwon one prompt appears, over here user enter the password , and if password is correct then and after then user can select value of that dropdown box.
so how i can achieve this functionality?
Simple:
disable/hide the select
onclick: open a prompt or dialog
onsubmit: send the data via AJAX and check the password in background with PHP (or another server-side language)
enable/show the select, if the password was right
Notice:
Javascript is readable by the client, you've to check the password with PHP (or another server-side language). If you write the password in Javascript, the user could figure it out by reading the source code.
The user could manipulate the HTML and Javascript local. You must verify all of his sent data on the server side.
By the way
I would enable/disable the select due to the users rights
I am afraid there is no pre-made solution for you - you will have to develop your own, i.e. display disabled dropdown initially, display your own password form pop-up on click event, compare if passwords match and if they do, finally enable the dropdown.
The most challenging issue here will be password protection. If you want to have this feature at least a little secure, you can't just include correct password in your js/jquery source code. Either use encryption or AJAX for that.
You could position a invisible div over the field absolutely, and listen for a click event on that div. If the password is correct remove the div.
If you wanted to be security conscience I wouldn't include the dropdown at all unless they get the password right. Return the contents of the select once the password is correct.
Once the password is correct you can populate the selectfield and open it.
Because even if you disable the select like others are saying there is nothing stopping someone from going into the html and enabling it. It needs to be unavailable unless verified.

Password masking as in mobiles using js

Can any one suggest to build a password field that behaves the way passwords are entered using iphone?
When I enter some character, it should be visible to the user for a second and then it should turn to *. But I need to get the value from the field when I submit the form.
Its an ExtJs text field. Is there any plugins available for this? Any help on this will be helpful.
Probably, this can help you:
http://blog.decaf.de/2009/07/iphone-like-password-fields-using-jquery/
Check out this Fiddle
Change textfield to stars like iPhone
Note: this solution is NOT complete and NOT optimal, for example you will have to handle Delete and Backspace buttons manually. You might find some plugin to do it in other way, but this is the simplest way to do it JavaScript I guess.

Ideas on limit the text on textfield?

for example, I want the textfield input number only. my idea is when the user typing, it will call a javascript to check whether it is valid, if it is not valid, I delete the text which is just entered. But I think it is very complex to do so. Is there any simple way to do so?
Put a validation on submit.
JQuery Masking could be a good choice: http://digitalbush.com/projects/masked-input-plugin/
The script to do this is here. It's a pretty common requirement.
http://javascript.internet.com/forms/validate-numeric-only.html
I think, like o.k.w said, jQuery Masking would be a good choice because of 2 things:
jQuery is solid and fast
Masking is more user friendly than just deleting user input on the fly without any notification. Masking gives them a graphical reference of what type of input is expected and what the input might look like.

Categories

Resources