GSA Cookie Auth - "Login form doesn't have both text and password inputs" - google-search-appliance

I can't seem to find out what's wrong with the login form I'm using to setup cookie authentication, the GSA throws me this error (serving log) after submitting my credentials in universal login form:
Got form; name=customlogin clientLogin; action=/content/marketing/en/login/j_security_check; type=hidden, name=resource; type=hidden, name=_charset_; type=hidden, name=j_username; type=hidden, name=j_password
Login form doesn't have both text and password inputs
Error in authentication module: Login form doesn't have both text and password inputs
Here is the form I'm using:
<form method="POST" action="/content/marketing/en/login/j_security_check" id="form_customlogin" name="customlogin clientLogin" enctype="multipart/form-data" onsubmit="return cq5forms_validate_customlogin();">
<input type="hidden" name="resource" value="/content/operations/apps/en.html" />
<input type="hidden" name="_charset_" value="UTF-8" />
<input id="username" type="hidden" name="j_username" value="anonymous-user" />
<input id="password" type="hidden" name="j_password" value="anon" />
<p>
Or go straight through as a
guest
(limited access)
</p>
</form>
Does anyone have knowledge on how a form has to be built in order for the GSA to use it? It'd be very welcome.
Thanks in advance!
EDIT: Apparently, inputfilds user/pw must have type username and password, they can't be hidden.
This was already a feature request.

The username field will have to be type="text", there is no type="username". Out of curiosity, why would you have them hidden?
Very often, when you have complicated login forms, your best bet is to create a separate login form just for the GSA that doesn't include any JavaScript or other wackiness.

Related

Laravel page expired 419 only sometimes

I have a view in my Laravel application that has a form with the #csrf inside. The problem is that I faced the 419 Page expired exception only sometimes. When I refreshed the page, the login page appeared and after login, a few times the form submission was done successfully but again, 419 occurred.
I saw the other topics. All of them told that the solution is adding the #CSRF directive to the form.
But in my special case, the #CSRF exists.
Help me please.
Update
Here is a part of my source code. It's a simple html form with the #CSRF inside it.
<form method="POST" action="/settingUrl">
#csrf
<input type="text" name="myfield" />
<input type="submit" value="save" />
</form>

AJAX call to PHP not working yields a blank page

We are implementing the "forget password" feature for our website.
We are usign HTML, JQquery mobile and AJAX .
we have a main file, which has the hyperlink for the forget password using the '' tag.
The password.html has form elements as below:
<form method ="post" id="forget" action="somefile.php" >
<h4>Enter your login email to change your password..</h4>
<label for="email" class="ui-hidden-accessible">Email:</label>
<input type="email" name="email" id="email" value="" placeholder="email" data-theme="a" />
<input type="submit" value="Submit" data-theme="b" />
</div>
</form>
The php file validates the email and sends the response in JSON format , which we are handling through a ajax call.
The problem is after hitting on "submit" in the password.html, we are able to retreive the data from the php file(able to see in network tab of browser) but it does not display on the frontend.
The browser is navigating to the php file (which it should not) and a blank page is being displayed.
Ps: When we directly load the password.html in the browser the behaviour is absoultely fine , but when we are navigating from the main file usign the hyperlink to password.html then this problem occurs.

spring security CSRF protection

I read in spring documentation that logout need to be submitted using post method.Something like :
<c:url var="logoutUrl" value="/problemSolution/logout"/>
<form action="${logoutUrl}" id="logout" method="post">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
</form>
Logout
Why is it so ?
Because if it's a GET then someone else can log you out, which is annoying.
You go to compromised.com
They run a script that makes a GET request to yourbank.com/logout
You are logged out of yourbank.com

google checkout integration - codeigniter

I have site built in codeigniter framework.
I want to use google checkout.
I have used this code to transfer fund but I need something returned so that I can know that transfer is successful and then enter values to my database.
I am not sure how to do that.
Can anyone show me step by step how to do that?
My form :
<form action="https://sandbox.google.com/checkout/api/checkout/v2/checkoutForm/Merchant/xxxxxxx" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_top">
<input name="item_name_1" type="hidden" value="Deposite"/>
<input name="item_description_1" type="hidden" value="Money Deposite"/>
<input name="item_quantity_1" type="hidden" value="1"/>
<input name="item_price_1" type="text" value="30.0"/>
<input name="item_currency_1" type="hidden" value="USD"/>
<input name="_charset_" type="hidden" value="utf-8"/><br />
<input alt="" src="https://sandbox.google.com/checkout/buttons/buy.gif?merchant_id=xxxxxxxx&w=117&h=48&style=white&variant=text&loc=en_US" type="image"/>
</form>
...but I need something returned so that I can know that transfer is successful and then enter values to my database...
The Google Checkout API calls that "Part 2" or "Process Checkout Orders".
Here's a tutorial using their Java lib. Note that it doesn't mean you "have" to use this (or any) specific lib, it just shows you the flow.
Other libs are here.

MVC 3 File Upload

I want to use mulitple File uploaders on my Razor view form. For this I tried File upload Web helper (#FileUpload.Gethtml()) but unable to call desired controller action. Any help on this or some other way will be highly appreciated.
Thanks
Vivek
You could use a simple html form with multiple file upload inputs and set the form action to post your controlle action
For example
<div>
<h2>File Uploads Updates</h2>
<form action="/FileUpload/UploadMultiple" method="post" enctype="multipart/form-data">
<label for="file">FileAt:</label>
<input type="file" name="fileA" id="fileA" /><br />
<label for="file">FileB:</label>
<input type="file" name="FileB" id="FileB" /><br />
<input type="submit" name="submit" value="Submit" />
</form>
</div>
See Also this Hanselman post on how to do file uploads in MVC
If you're willing to use third party controls, take a look into Telerik upload control.
It is an open source one (GPL 2 ? license)

Resources