I'm currently working with objective-c and have run in to a problem concerning javascript. I am connecting to a website through an iphone app and my goal is to login to a html form (Login.jsp)
<label class="login_label">Username</label>
<input autocomplete="off" type="text" value="" name="ssusername" size="20" maxlength="50" />
<label class="login_label">Password</label>
<input autocomplete="off" type="password" name="sspassword" size="20" maxlength="20" value=""/>
I am trying to make a NSUrlConnection to this site in objective-c but the concern is this: If I enter
https://www.login.com/Login.jsp?ssusername=%#&sspassword=%#, username.text, password.text
It will only enter the enter the password in the html form. And when I look at the javascript I suspect it has something to do with the value in the username html code being value=""
My question: Is it possible to, without changing the html code (as I don't have access to it) make a NSUrlConnection passing username and password and retrieving the answer from this html form, or if anyone know why the username wont show when the adress is entered as above?
I think, login method may use POST method and your NSURLConnection is using get method.
You can check at POST with NSURLConnection - NO JSON.
It depends on server side. You can't really change input field value via GET parameters -- it's server-side job.
You can execute JS code to enter username and password and then click login button via UIWebView's stringByEvaluatingJavaScriptFromString function or you can check this site/server documentation for some authentication methods and then use them (like #saturngod suggested).
Related
I want my users to write his website on my site and then be sent to gtmetrix.com to start a new test, but without needing to write his website again.
I am trying with this:
<form method="post" action="https://gtmetrix.com/analyze.html">
<input type="text" placeholder="Enter your Website URL"></input>
<input type="submit">CHECK IT</input>
</form>
But i get a
Analysis Error
You tried to analyze an invalid/malformed URL
What i am doing wrong? is possible to do this?
It seems they require the url in the form data field called url.
You must use the following input tag:
<input type="url" name="url" value="" placeholder="Enter your website URL" maxlength="1024" autofocus="" required="">
Also, they could be blocking external referrers. But first try adding the name attribute.
First of all, I don't know if that website allows you to submit that form from external websites. Make sure that's possible!
Seccond of all, you are trying to sent a form without setting the name of the input field. The resource that receives your request don't know anything to do with it.
If you want to analyse websites on your own website, search for services that provide APIs for using it external.
I am not familiar with gtmetrix, but you need to set the name attribute on your input to send it with the request.
I'm working on a webapp written in angular that seems to have trouble interacting with the various password managers (Dashlane, LastPass, etc) that are out there. Are there any guidelines around HTML markup and authentication flow to ensure compatibility? This is not just for login flow, but also includes things like password reset, user name changes, and so on.
It appears that this question has already been asked, but not in the context of AngularJS.
From https://lastpass.com/support.php?cmd=showfaq&id=3385
While LastPass can work on most website logins, if you are developing your own site you can help make it LastPass-compatible by using a simple form submit with a username, password, and submit field.
Here's an example:
<form action="https://mypage.com/blah" method="post">
<input type="text" name="username" id="username" value=""/>
<input type="password" name="password" id="password" value=""/>
<input type="submit" value="LOGIN"/>
</form>
As far as what to avoid -- always create the form on page load, even if you hide and show it to people clicking log in, it's better to be there on page load. Avoid ajax for logging in and avoid method=GET
So besides giving name attributes to your controls, LastPass recommends having the login form markup already in the HTML when it is first loaded.
I have a jsp form in which a user can signup by entering username and password. I have to check dynamically whether the username exists in mysql database as the username is typed into the text box. Here is a sample code:
<html>
<head>Sample Signup</head>
<body>
<form action="updatedb.jsp" method="post">
Username : <input type="text" name="uname">
<br>
Password : <input type="text" name="upass">
<br>
<input type="submit" value="signup">
</form>
</body>
</html>
I am new to jsp so an elaborated answer will be more helpful. If i missed any other important info, ask me right away.
Java cannot respond to the client-side methods like onChange (not directly). Those methods call Javascript. Javascript is not actually related in any way to Java; its only called that because it uses the bracket-style syntax for functions as opposed to VB-style syntax. The only way to involve Java itself in the client-side methods would be to use Javascript to send an Ajax request to a JSP/Servlet and receive a response back. The simplest way to send an Ajax request in Javascript is with jquery (a javascript library).
I am trying to make a code that will automatically login into a webpage for you, but I am having trouble finding the url variables for the submission.
How can I find the url variables to submit the login?
i.e.
https://login.fidelity.com/ftgw/Fas/Fidelity/RtlCust/Login/Init
When I submit my username and password on the site, it passes it through to
https://login.fidelity.com/ftgw/Fas/Fidelity/RtlCust/Login/Response
The username <input> has id="userId", and the password <input> has id="password", and this is all under a <form> which has method="POST"
How can I find all variables that I need to submit?
The URL variables aren't always in the URL.
Most Login forms use a method of transferring that data called "POST".
In which the URL data cannot be seen by the user.
You can try using http://www.wireshark.org/ or http://www.charlesproxy.com/ to view the data sent and received by your web browser.
To find the name of the URL parameters (such as ?username=....&pas=...).
You can look into the HTML of the page. Look for something like so:
<form action="login.php" method="post">
<input type="text" name="username" value="User Types Username Here">
<input type="submit">
</form>
Can use Chrome (Ctrl + Shift + J) Network tools. Click "Preserve Log" to ensure you capture payload before page refreshes.
I am trying to make a form in html that uses the value you enter to form the destination URL.
<form action="../search/${params.q}" method="post" id="q">
Busqueda: <input type="text" name="q" /><br />
</form>
This is what i am doing, but it does not work, any cluess? thanks!
You'd need to handle this using a script - either server-side or on the client (JavaScript).
HTML alone can't handle parameters in the way you're using them.
So you'd need to either POST the form (as you're already doing) and handle the postback by redirecting your request to the new address, or use JavaScript to capture the field's value when a submit button is clicked and loading the new address in the browser window.
I'd suggest server-side is the best option as JavaScript might be disabled or unavailable.