Chrome auto-complete the wrong from field - ruby-on-rails-3

I am using Devise for authentication
In the settings I have 3 fields:
password (for entering a new password)
<input autocomplete="off" class="controls" id="user_password" name="user[password]" size="30" type="password">
password confirmation
<input class="controls" id="user_password_confirmation" name="user[password_confirmation]" size="30" type="password">
current password
<input class="controls" id="user_current_password" name="user[current_password]" size="30" type="password">
I want the current password to be autocompleted but chrome autocomplete the password confirmation for some reason
Is there a way to tell chrome which field is the password field to be autocompleted?

You have set autocomplete="off" only on user_password. Maybe you should set it where you want them to be.

Related

How to stay on the same page after a form submission integrated to a Google form

In my website i have a contact form, and i've integrated it with a Google form. I've added the google form's execute URL as the action URL so once its submitted the form is being populated with the form data. the way i have done it
But when its being submitted, its redirecting to a google form's response page. What i need is once its submitted, to stay on the same page and give an alert. Im not sure how to do this in vue js. Any suggestion will be appreciated.
the content on the redirected page
{"result":"success","data":"{\"name\":[\"sdvsdv\"],\"company\":[\"dsvdv\"]}"}
Form in vue js view
<form method="POST" id="appointment-form" action="https://script.google.com/macros/s/AKfycbzRHvjfmIZdwKnOm26PeFv64OyyyGAfcr68MxvYw/exec">
<div class="form-group">
<input type="text" placeholder="Your name" name="name" class="form-control" id="name" required>
</div>
<div class="form-group">
<input type="text" placeholder="Company name" name="company" class="form-control" id="company" required>
</div>
<buttontype="submit" class="btn btn-default btn-block form-submit-btn">Submit</button>
</form>
After read your code properly, i found many errors.
How are you saving input values?
To save, you have to use ```v-model directive````
I guess you save the input values in somewhere. To avoid your problem, you can add a method and call it on submit, and inside the method save your input values.

Problem for authenticating login creds in Flask

I'm trying to authenticate a login request from my login.html file
<form action="{{ url_for('login') }}" method="post">
<div class="col-sm-6">
<h2>Already a user, Login here!</h2>
<div class="form-group">
<input class="form-control" name="username" placeholder="username" required>
</div>
<div class="form-group">
<input type="password" class="form-control" name="password" placeholder="password" required>
</div>
<div class="form-group">
<button class="btn btn-primary">Log In</button>
</div>
</div>
</form>
here is the flask snippet
#app.route("/login", methods=["POST"])
def login():
username = request.form.get("username")
password = request.form.get("password")
if db.execute("SELECT username FROM users WHERE username=:username AND password=:password", {"username": username, "password": password}).fetchone() == username:
session['username'] = username
return render_template("home.html")
return render_template("error.html", message="username or password is incorrect",prompt="alert alert-warning")
When I enter wrong creds, it prompts me to the wrong creds message, which I pretty much want. Now problem is if I add the correct creds, then also it is showing me the same message. My database is connected properly and there's no issue with that. Is something wrong with my way of writing the query, as I'm a beginner in Flask and SQL
fetchone returns a sequence (list), so the if test is never true.
From the python Sqlite3 doc:
fetchone()
Fetches the next row of a query result set, returning a single sequence, or None when no more data is available.
One option: Since the result of fetchone is a list, the element to compare with username would be the first member returned i.e. ....fetchone()[0].
Another option: Assuming username is unique, the query will return one row or no rows. fetchone will return None if there are no rows. None is falsey therefore the equality is not necessary in the if clause.

Inputs and its attributes are constantly changing in Dynamic x-path in Selenium

I tried to find the x-path of a text field username and password, but it keeps on changing dynamically.I won't be able to use starts-with or contains in a findelement using x-path. Here's the HTML DOM-
<div id="contents">
<h1 style="white-space:pre; width:80px; float:left;line-height:35px;">Login</h1>
<span style="float:left; padding-top:13px; COLOR:#990033; font-weight:bold;"> Student | Parent | Faculty</span>
<div class="form-elements">
<div class="form-elements">
<div class="form-elements">
<div class="label-txt">Password</div>
<input id="rcnr2uew1m0rkikeaaniwk" type="password" style="display:none;" name="rcnr2uew1m0rkikeaaniwk"/>
<input id="ko2xs123ebqyoluh15bulu" type="password" style="display:none;" name="ko2xs123ebqyoluh15bulu"/>
<input id="cuouek4bfz41etm4hroj0r" type="password" style="display:none;" name="cuouek4bfz41etm4hroj0r"/>
<input id="u2ta3gv2o2ce0azx5plpuh" type="password" name="u2ta3gv2o2ce0azx5plpuh"/>
<input id="g03nwjuzhqnkuwgsl4q2mu" type="password" style="display:none;" name="g03nwjuzhqnkuwgsl4q2mu"/>
<input id="gddwv4z3amojk0yvoxi2v4" type="password" style="display:none;" name="gddwv4z3amojk0yvoxi2v4"/>
<input id="kxecmkho2vf1vcfb42icjr" type="password" style="display:none;" name="kxecmkho2vf1vcfb42icjr"/>
<span id="ctl04" style="color:Red;visibility:hidden;">*</span>
</div>
I tried to find the input[4] with no style.
Absolute x-path- html/body/form/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/input[4]
Next time how it changes-
Absolute x-path- html/body/form/div[3]/div[1]/div[2]/div[1]/div[1]/div[1]/div[2]/input[17]
id and name of the input also keeps on changing without any common trait
You can do it by locating sibling of the User name label that is displayed, i.e. without attribute style="display:none;"
User Name
"//div[contains(text(), 'User Name')]/following-sibling::input[not(#style='display:none;')]"
Password
"//div[contains(text(), 'Password')]/following-sibling::input[not(#style='display:none;')]"
Or something similar using type attribute:
//input[#type='password'][not(#style)]

jquery-ui dialog password already filled at open

As wanted, dialog box for login is opened, but password is already filled in, although I put password field with value=""
<div id="dialog" title="Connexion aux données">
<form>
<fieldset class="ui-helper-reset">
<br>
<div>Nom du foyer</div>
<input type="text" name="foyer" id="foyer" value="" class="ui-widget-content ui-corner-all"><br>
<div>Mot de passe</div>
<input type="password" name="password" id="password" value="" class="ui-widget-content ui-corner-all"><br>
<div style="font-size:0.6em;padding-top:6px;">Afficher les caractères</div>
<input type="checkbox" name="reveal" id="reveal" value="" class="ui-widget-content ui-corner-all" style="width:20px;">
</fieldset>
</form>
</div>
and Jquery code in head part
var $dialog = $( "#dialog" )
.dialog({
autoOpen: false,
modal: true,
resizable: false,
draggable: false,
close: function(event,ui) {
$(this).find('form')[0].reset();
}
});
$dialog.dialog('open');
I have also cleaned browser cache but nothing changed.
By clicking on reveal checkbox I saw password is the same I have used in previous dev for testing few months ago.
Why this happens and how to avoid it ?
This happened for me too. After debugging I found out that it was the password that browser had saved and it was loading it onto the password field on page load.
After clearing the saved password, I was able to get the empty password textbox.
This could be the case with you too.

Worklight Disable password save

Im trying to disable the "Do you want the browser to remember this password" popup of the webview,
I added the line
this.appView.getSettings().setSaveFormData(false);
In the onCreate, before the loadURL command. But it does suppress the save password info feature.
ADDITION:
This is happening when the user submits their login information in the login form on my app:
<form onsubmit="dojo.byId('passwordLogin').blur();return false;">
<input id="emailAddressLogin" type="email" data-dojo-type="dojox.mobile.TextBox" placeholder="Email Address" value="" selectOnClick="true"></input>
<input id="passwordLogin" type="password" data-dojo-type="dojox.mobile.TextBox" placeholder="Password" value="" selectOnClick="true"></input>
<br/>
<button data-dojo-type="dojox.mobile.Button" type="submit" class="baseBtn navyBtn loginButton" onClick="processLoginAuthentication()">Login</button>
</form>
I believe the following should work:
this.appView.getSettings().setSavePassword(false);