HTML Password input - Password revealed in the URL - html

Ok, so this is the problem. I have a password input form that looks like this:
<form class="form1" action="WEBSITE.HTML" onsubmit="return (this.pass.value==='1234')?true:false;">
<div class="row uniform half collapse-at-2">
<div class="8u">
<input type="password" name="pass" id="password" placeholder="Input password"/>
</div>
<div class="4u">
<input class="fit" type="submit" value="Go" onclick="if (document.getElementById('password').value == '1234');" />
</div>
</div>
</form>
It works great, the only problem is that when I submit the right password, it redirects me to the website, for example, google, with this URL: google.com?pass=1234. So it basically reveals the password when someone inputs it correctly. Is there any way to avoid this? Hope I was clear enough.

Put method attribute in your form:
<form method="post" class="form1" action="WEBSITE.HTML" onsubmit="return (this.pass.value==='1234')?true:false;">
And I think you don't need to use ===, use simple == instead.
UPDATE:
if your site doesn't like some hidden post values, use redirect without sending any of values:
<form class="form1" onsubmit="validateForm(); return false;">
<div class="row uniform half collapse-at-2">
<div class="8u">
<input type="password" name="pass" id="password" placeholder="Input password"/>
</div>
<div class="4u">
<input class="fit" type="submit" value="Go" />
</div>
</div>
</form>
<script type="text/javascript">
function validateForm()
{
var pass = document.getElementById('password').value;
if(pass == '1234') //here 1234 is your password
window.location = 'https://www.google.com';
}
</script>

Related

What should I change in this two code block so that I can open different web pages

#{
ViewData["Title"] = "Login";
}
<h1>#ViewData["Title"]</h1>
<div class="container">
<form action="/action_page.php">
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" name="email">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd">
</div>
<div class="checkbox">
<label>
<input type="checkbox" name="remember">Remember me
</label>
</div>
**<script>function openWin() {
window.open("https://localhost:7257/Home/Stocks");
}</script>
<form>
<button type="submit" class="btn btn-primary" value="Login" onclick="openWin()">
Login
</button>
</form>
<script>function openWin() {
window.open("https://localhost:7257/Home/Signup");
}</script>
<form>
<button type="submit" class="btn btn-primary" value="Sign up" onclick="openWin()">
Sign up
</button>
</form>**
</form>
</div>
After executing this code block the page that is similar to photo can be displayed but my problem is how should I change these 2 buttons functions so that they can pop up different locations like it is written in the bold area.
If there is any related page similar to this issue, you can share as comment.
It looks like you've named both functions openWin(). When you click the button it's finding the the top function and never makes it to the second one since it thinks it found what it was looking for. JS runs from top to bottom in order so as soon as it finds the first function it will stop.
You need to change one of the function names when you declare it, such as openWin() and openWin2().
I would also recommend that you move all of your JS code to a single <script> tag in order to avoid errors in the future.

FormSubmit says my form should use method=POST but it actually does

I'm using FormSubmit to create a contact form in my static website (hosted on a server).
My form looks like this:
<div id="contact-area" class="container">
<h1>~$ contactme</h1>
<br>
<form action="https://formsubmit.co/c379c266434ca1a039bdf03209919395" method="POST">
<div class="form-group">
<div class="form-row">
<div class="col">
<input type="text" name="name" class="form-control" placeholder="Your name..." required>
</div>
<div class="col">
<input type="email" name="email" class="form-control" placeholder="Your e-mail" required>
</div>
</div>
</div>
<div class="form-group">
<textarea maxlength="1000" placeholder="Your message..." class="form-control" name="message" rows="10" required></textarea>
</div>
<input type="hidden" name="_template" value="table">
<input type="text" name="_honey" style="display:none">
<input type="hidden" name="_captcha" value="false">
<input type="hidden" name="_next" value="message_sent.html">
<button type="submit" class="btn btn-lg btn-dark btn-block">Submit</button>
</form>
</div>
My email is verified. When the user clicks on submit button, this message appears in a new page:
" Make sure your form has the method="POST" attribute "
However, I receive the message. That's weird. Anyone know why it says my form should have POST attribute while my form actually has the post attribute.
Your code snippet is all okay. I have tested it, forms are getting submitted, and nothing wrong except the way you implement the "_next" feature. As FormSubmit documentation clearly mentioned you have to provide an alternative URL not just a path or file, it should be a URL.
<input type="hidden" name="_next" value="https://yourdomain.co/thanks.html">
Please change the hidden filed in your form to:
<input type="hidden" name="_next" value="https://yourdomain.co/message_sent.html">
and that should probably work fine.
Additional information:
FormSubmit documentation: https://formsubmit.co/documentation
I guess you have gone wrong in the action of the form.
Try using this:
<form action="https://formsubmit.co/your#email.com" method="POST">
<!-- Your form inputs here -->
</form>

How to concatenate a user inputted string using HTML input tag

I am doing the following:
<form action="https://www.google.com/search">
<div>
<input type="text" name="q" id="corners">
</div>
<div>
<input type="submit" value="Google Image Search">
</div>
</form>
However, I want to add additional default text to the URL after the user's input like this:
https://www.google.com/search?q=searchterm&some-additional-text
How can I do this?
The following code uses JavaScript to concatenate https://www.google.com/search?q=, the input value and any additional text, then assigns that string to the action attribute of the form, before submitting the form.
function submitForm() {
var form = document.getElementById("form");
var search = document.getElementById("corners").value;
var additional = "&";
form.setAttribute("action", "https://www.google.com/search?q=" + search + additional);
form.submit();
}
<form action="https://www.google.com/search" id="form">
<div>
<input type="text" name="q" id="corners">
</div>
<div>
<input type="button" value="Google Image Search" onclick="submitForm()">
</div>
</form>
I ended up just using the following:
<div>
<input type="hidden" name="test" value="test" style="display: none;">
<input type="text" name="test">
</div>

Html code not working in Safari, but working in all other browsers

And I think it's not possible to submit the form in Safari browser
This is working fine in all browsers except safari
<form action="/commonDashboard" name="loginForm" method="post" autocomplete="off" id="loginForm">
<div>
<label>User Email ID</label>
<input type="text" placeholder="Enter your Email Address" id="userEmail" name="userEmail" tabindex="1" />
</div>
<div>
<label>Password</label>
<input type="password" placeholder="Enter your password" id="userPassword" name="userPassword" tabindex="2" />
</div>
<div>
<input type="button" value="Sign In" onclick="validatelogin();" tabindex="3" />
</div>
</form>
Change type="button" to type="submit"
Remove onclick="validatelogin();"
Assuming validatelogin is NOT performing any Ajax, change <form action="/commonDashboard" to
<form action="/commonDashboard" onsubmit="return validatelogin()" and have that function return true to allow submit or false to stop
or better add
window.onload=function() {
document.getElementById("loginForm").onsubmit=validatelogin;
}
In any case, please post the function so we can see what it does

remember passowrd works in ff but not in ie and chrome

It seems that my html login form supports "remember password" in ff but not in ie and chrome. Can anybody tell me why? Here's the code:
<form name="login_form" id="login_form" action="" method="POST">
<div class="login_line">name<input name="user_name" id="user_name_id" size="16" maxlength="16" value="" type="text"></div>
<div class="login_line">password<input name="password" id="password_id" size="16" maxlength="16" type="password"></div>
<div class="login_line"> <input class="icon icon_accept" value="login" onclick="javascript:handleFunction('action_login', document.getElementById('user_name_id').value, document.getElementById('password_id').value); return false;" type="submit"></div>
</form> <!-- login_form -->
I've checked my settings in Chrome and IE.
You might want to use onsubmit instead of onclick for forms... I'm not sure if pressing Enter on a textbox will fire onclick on all browsers.
<form name="login_form" id="login_form" action="" method="POST" onsubmit="handleFunction('action_login', document.getElementById('user_name_id').value, document.getElementById('password_id').value); return false;">
<div class="login_line">name<input name="user_name" id="user_name_id" size="16" maxlength="16" value="" type="text"></div>
<div class="login_line">password<input name="password" id="password_id" size="16" maxlength="16" type="password"></div>
<div class="login_line"> <input class="icon icon_accept" value="login" type="submit"></div>
</form> <!-- login_form -->
Should work as the code is correct. Check browser settings?
In your CSS html,body change overflow-x = hidden to just overflow = hidden