VeeValidate - how to validate URL that should be with http:// - vuejs2

I have tried to validate my input with:
<input
type="text"
name="webhookURL"
placeholder="Enter webhook URL"
class="text-input"
v-validate="'required|url'"
/>
but it's returns true if I will fill the input like this: google.com,
so I need that validation return true if I will fill like this http://exampleURL.com (with http:// or https://)

You must use the require_protocol
<input v-validate="{url: {require_protocol: true }}"
See the doc

Related

Karate Extract () is not recognised as a function ,Karate version used is 0.9.5

Karate.extract() is not being recognised
And header Authorization = 'Bearer '+ tkn1
Then status 200
def htmlresponse = response
def extracted = karate.extract(htmlresponse,'code+value=\"([^\"]+)',1)
HTML
<form method="post" action="SomeURL">
<input type="hidden" name="code" value="1234" ng-non-bindable />
<input type="hidden" name="id_token" value="123" ng-non-bindable />
karate.extract(HTMLResponse,'HtmlResponse+value=\"([^\"]+)',1), TypeError: karate.extract is not a function in at line number 1
Yes I think this is a new API. Please upgrade to the latest version 1.2.0

asp.net MVC form POST working in Localhost but not working after publishing

HomeController.cs:
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(LoginInfo login)
{
if (Request.Form["Submit"] != null)
{
string Username = login.Username;
string Password = login.Password;
ViewBag.Massage = "";
if (Username == "Admin" && Password == "123")
{
ViewBag.Massage = "Login Successfull";
return RedirectToAction("MSISDN","UnSub");
}
else
{
ViewBag.Massage = "Please Enter Valid Login Information";
}
}
return View();
}
Views/Home/Index.cshtml
<form name="myForm" action="/Home/Index" method="post">
<div align="center">
<div style="color:red">#ViewBag.Massage</div>
<br>
<label for="Username">Username:</label>
<input type="text" name="Username" id="Username">
<label for="Password">Password:</label>
<input type="password" name="Password" id="Password">
<br>
<input type="submit" name="Submit"value="Submit">
</div>
</form>
This code is works perfectly in my localhost. But when I publishe my project to IIS Server it is not working. It is returning -
Server Error: 404 File or Directory Not Found.
May be it conflicts with my physical path and requested path. How to resolve this problem?? :(
The action's url in the form tag may be wrong :
If the url for display and post the data is the same, you can remove action="/Home/Index"
If you want to specify the url, please use action="#Url.Action("Index")"
It will automatically resolve the Url.
My Code is working properly after using an tilde (~) sign before action.
For example:
action="~/Home/Index"
After using this sign my code works properly. It reduce the conflicts between virtual path and physical path.

Paypal Transparent Redirect RETURNURL post parameters

Currently trying to implement transparent redirect with Paypal but unable to get the return url to contain the parameters I am setting. Appears that paypal is stripping out the parameters from the returnurl querystring and as such my site is not behaving properly after the redirect. My sequence is as follows:
1- Make a secure token request to Paypal passing the returnurl and errorurl as part of the token request.
2- Embed the secure token value obtained from paypal within my form (which posts directly to paypal).
3- Paypal redirects back to the returnurl but the parameters are missing....attempting to redirect back to https://www.somesite.com/site.w?location=results.w&parameter1=value1 but am instead redirected to https://www.somesite.comt/site.w?location=results.w (missing the parameter1=value1).
I have tried url-encoding the returnurl so the ampersands and question mark are encoded but as per the paypal documentation values in the return url are not to be encoded.
Does anyone know how I can get the returnurl to contain the proper GET parameters during the paypal redirect?
Thanks again,
Tony
Just to follow up....Ok so encoding the ampersand (& -> %26) and adding the length to the RETURNURL parameter did work and did pass the value although the browser did not properly interpret the url upon redirect. I tried again without encoding the ampersands but kept the length of the RETURNURL intact and the url parameters were preserved upon redirect! So my final solution would be a secure token request containing the RETURNURL which contains the length feature so that Paypal can properly parse the returnurl value (maintaining the querystring parameters). Example as follows:
/opt/pware/bin/curl -s -S -k --connect-timeout 30 --max-time 120 -H "X-VPS-CLIENT-TIMEOUT:45" -d "PARTNER=PayPal&VENDOR=somevendor&USER=someuser&PWD=somepassword&TENDER=C&CREATESECURETOKEN=Y&SECURETOKENID=0000050&SILENTTRAN=TRUE&rm=2&TRXTYPE=A&AMT=40.00&RETURNURL[123]=https://somesite.com/cgi-bin/test/site.w?location=b2c/retail-checkout.w&frames=no&target=main&lang=en-US" https://pilot-payflowpro.paypal.com
For anyone else wondering what to do once you obtain the secure token simply embed the token in your form and the returnurl should contain the proper parameters....heres a sample static html page which you can use for testing the post of your secure token/ secure token ID combo:
<html>
<head>
</head>
<body>
<form id="form" method="POST" action="https://pilot-payflowlink.paypal.com">
<input type="hidden" id="SILENTTRAN" name="SILENTTRAN" value="true"/>
<input type="hidden" id="CURRENCY" name="CURRENCY" value="USD"/>
<input name="VERBOSITY" type="hidden" value="HIGH">
<input type="hidden" name="rm" value="2">
<!--<input name="MODE" type="hidden" value="TEST">-->
<p>SECURETOKEN</p><input type="text" id="SECURETOKEN" name="SECURETOKEN" />
<p>SECURETOKENID</p><input type="text" id="SECURETOKENID" name="SECURETOKENID" />
<p>Address:</p><input type="text" id="BILLTOSTREET" name="BILLTOSTREET" value="123 Test"/>
<p>Zip:</p><input type="text" id="BILLTOZIP" name="BILLTOZIP" value="90210"/>
<p>AMOUNT:</p><input type="text" id="AMT" name="AMT" value="33.00"/>
<p>CSC:</p><input name="CVV2" type="text" value="123">
<p>TRXTYPE:</p><input type="text" id="TRXTYPE" name="TRXTYPE" value="S">
<p>Card Number:</p><input type="text" id="ACCT" name="ACCT" maxlength=16 value="4111111111111111">
<p>Expiry MONTH:</p><input type="text" id="EXPMONTH" name="EXPMONTH" maxlength=2 value="01">
<p>Expiry YEAR:</p><input type="text" id="EXPYEAR" name="EXPYEAR" maxlength=2 value="16">
<input type="submit" value="Submit">
</form>
</body>
</html>
It should work as I tested in my test environment and it worked for me . But I passed the length tag with each of the parameter in the request while creating the secure token and did the encoding for "&" .
Like below :
ERRORURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1
CANCELURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1
RETURNURL[86]=https://www.somesite.com/site.w?location=results.w%26parameter1=value1%26parameter1=value1
See the attached image too :

qq-form does not upload file to S3 bucket and ignores {request: endpoint}, still returns 200

I am using FU-5.0.8 on Ubuntu14, apache2 php5. I successfully created page to drag n drop file, create signature and upload to my AWS S3 bucket.
I then integrated that code into an existing form, using the qq-form. The FU element and the form are generated correctly, I am able to enter data and the data is posted to my DB including the key file name generated by FU.
Issue 1: FU is not pointing to the bucket I have identified in my script. Instead of the correct bucket as before, it make my domain the target bucket name.
Issue 2: FU provides a progress bar and shows the upload is complete and returns 200. I don't know how this is possible, do FU check that the file actually exists upon completion?
Here are the standalone upload script and the script with the form. As you can see they have an identical endpoint. I have included the POST created from the qq-form where you can see the endpoint is incorrect.
FU in the JSON POST is setting the bucket to www.biggytv.com, which does not exist. It should got to btv_upload_org.s3.amazonaws.com
You assistance is appreciate.
FORM CODE
<form action="https://www.biggytv.com/btvChannels/FSsubmit.php" id="qq-form" class="span6">
<div id="fineuploader-s3" class="span6"></div>
<div class="form-group span2">
<label>Program Title</label>
<input type = "text" class="span4" name="program_title" maxlength="200" autofocus="" required>
</div>
<div class="form-group span6">
<label>Program Description</label>
<textarea name="description" maxlength="1000" class="span8" id="count_me" placeholder="Please do not include links in the Program Description. Add any links to content on other sites as part of your profile." required></textarea>
</div>
<div class="form-group span5">
<label>Video Language</label>
<select name="vid_language" class="span4" required>
<option value=""></option>
<?php $language->data_seek(0);
while($language_row = $language->fetch_assoc()){
$languageid = $language_row['short'];
$languagename = $language_row['name'];
echo "<option value=\"$languageid\">
$languagename
</option>";
}?>
</select>
</div>
<div class="form-group span5">
<label>Target Audience</label>
<select name="Audience_DART1" class="span4" required>
<option value=""></option>
<?php $audience->data_seek(0);
while($audience_row = $audience->fetch_assoc()){
$audienceid = $audience_row['tar_aud_code'];
$audiencename = $audience_row['tar_aud_name'];
echo "<option value=\"$audienceid\">
$audiencename
</option>";
}?>
</select>
</div>
<div class="form-group span5">
<label>Genre</label>
<select name="genre" class="span4" required>
<option value=""></option>
<?php $genre->data_seek(0);
while($genre_row = $genre->fetch_assoc()){
$genreid = $genre_row['genre_id'];
$genrename = $genre_row['genre_name'];
echo "<option value=\"$genreid\">
$genrename
</option>";
}?>
</select>
</div>
<div class="form-group span5">
<label>Rating</label>
<select name="Rating_DART" class="span4" required>
<option value=""></option>
<?php $rating->data_seek(0);
while($rating_row = $rating->fetch_assoc()){
$dartid = $rating_row['dart_rating'];
$dartname = $rating_row['dart_rating_name'];
echo "<option value=\"$dartid\">
$dartname
</option>";
}?>
</select>
</div>
<input type="hidden" name="content_owner_name" value=<?php echo $content_owner_name;?>>
<input type="hidden" name="channel_id" value="801102">
<div class="span6 offset2">
<input id="submitButton" type="submit" value="Submit" class="span4">
</div>
</form>
QQ-FORM
jQuery(document).ready(function ($) {
$('#fineuploader-s3').fineUploaderS3({
request: {
endpoint: "btv_upload_org.s3.amazonaws.com",
accessKey: "XXXXXXXX"
},
template: "qq-template",
signature: {
endpoint: "/finesig/"
},
forceMultipart: {
enabled: true
},
debug: true,
cors: {
expected:true,
},
resume: {
enabled: true
},
objectProperties: {
acl: "public-read"
},
validation: {
itemLimit: 1,
sizeLimit: 150000000,
acceptFiles: "video/mp4, video/quicktime, video/x-flv, video/x-ms-wmv",
allowedExtensions: ["mp4", "mov", "flv", "wmv"],
},
})
});
POST JSON
JSON
conditions
[Object { acl="public-read"}, Object { bucket="www.biggytv.com"}, Object { Content-Type="video/mp4"}, 12 more...]
0
Object { acl="public-read"}
1
Object { bucket="www.biggytv.com"}
2
Object { Content-Type="video/mp4"}
3
Object { success_action_status="200"}
4
Object { key="e001946c-a472-4412-9854-b44fede53e72.mp4"}
5
Object { x-amz-meta-program_title="Marcus%20Johns"}
6
Object { x-amz-meta-description="Marcus%20Johns"}
7
Object { x-amz-meta-vid_language="en"}
8
Object { x-amz-meta-audience_dart1="U"}
9
Object { x-amz-meta-genre="6"}
10
Object { x-amz-meta-rating_dart="G"}
11
Object { x-amz-meta-content_owner_name="MarcusJohns"}
12
Object { x-amz-meta-channel_id="801102"}
13
Object { x-amz-meta-qqfilename="7920637590280230638.mp4"}
14
["content-length-range", "0", "150000000"]
expiration
"2014-10-14T00:11:08.742Z
Uploader Log
[Fine Uploader 5.0.8] Sending simple upload request for 0
custom.....0.8.js (line 207)
[Fine Uploader 5.0.8] Submitting S3 signature request for 0
custom.....0.8.js (line 207)
[Fine Uploader 5.0.8] Sending POST request for 0
custom.....0.8.js (line 207)
POST https://www.biggytv.com/finesig/
200 OK
552ms
custom.....0.8.js (line 3810)
[Fine Uploader 5.0.8] Sending upload request for 0
custom.....0.8.js (line 207)
POST https://www.biggytv.com/btvChannels/FSsubmit.php
200 OK
938ms
custom.....0.8.js (line 9849)
[Fine Uploader 5.0.8] Received response status 200 with body: Array
(
[key] => 05a829e8-bea1-44f6-b35d-1f620f1043af.mp4
[AWSAccessKeyId] => XXXXXXXXX
[Content-Type] => video/mp4
[success_action_status] => 200
[acl] => public-read
[x-amz-meta-program_title] => Marcus%20John
[x-amz-meta-description] => Mar
[x-amz-meta-vid_language] => en
[x-amz-meta-audience_dart1] => U
[x-amz-meta-genre] => 6
[x-amz-meta-rating_dart] => G
[x-amz-meta-content_owner_name] => MarcusJohns
[x-amz-meta-channel_id] => 801102
[x-amz-meta-qqfilename] => 7920637590280230638.mp4
[policy] => eyJleHBpcmF0aW9uIjoiMjAxNC0xMC0xNFQwMDozNzoxNS44NjZaIiwiY29uZGl0aW9ucyI6W3siYWNsIjoicHVibGljLXJlYWQifSx7ImJ1Y2tldCI6Ind3dy5iaWdneXR2LmNvbSJ9LHsiQ29udGVudC1UeXBlIjoidmlkZW8vbXA0In0seyJzdWNjZXNzX2FjdGlvbl9zdGF0dXMiOiIyMDAifSx7ImtleSI6IjA1YTgyOWU4LWJlYTEtNDRmNi1iMzVkLTFmNjIwZjEwNDNhZi5tcDQifSx7IngtYW16LW1ldGEtcHJvZ3JhbV90aXRsZSI6Ik1hcmN1cyUyMEpvaG4ifSx7IngtYW16LW1ldGEtZGVzY3JpcHRpb24iOiJNYXIifSx7IngtYW16LW1ldGEtdmlkX2xhbmd1YWdlIjoiZW4ifSx7IngtYW16LW1ldGEtYXVkaWVuY2VfZGFydDEiOiJVIn0seyJ4LWFtei1tZXRhLWdlbnJlIjoiNiJ9LHsieC1hbXotbWV0YS1yYXRpbmdfZGFydCI6IkcifSx7IngtYW16LW1ldGEtY29udGVudF9vd25lcl9uYW1lIjoiTWFyY3VzSm9obnMifSx7IngtYW16LW1ldGEtY2hhbm5lbF9pZCI6IjgwMTEwMiJ9LHsieC1hbXotbWV0YS1xcWZpbGVuYW1lIjoiNzkyMDYzNzU5MDI4MDIzMDYzOC5tcDQifSxbImNvbnRlbnQtbGVuZ3RoLXJhbmdlIiwiMCIsIjE1MDAwMDAwMCJdXX0=
[signature] => d48Ibli+V6/RmN3bUUZKVJ0woew=
)
custom.....0.8.js (line 207)
[Fine Uploader 5.0.8] Simple upload request succeeded for 0
Update
In the FU documentation you referred to "Integrating with existing html forms", the "simple example" 'action' is set to a script not a S3 bucket, that is why I am confused.
However, I have configured my script in the manner of your answer.
When I set the Action to the bucket, the uploadSuccess: {endpoint} POST does not include any of my form data, just key, uuid,name,bucket,etag.
If I set the Action as to https://www.biggytv.com/btvChannels/FSsubmit.php, the form data is sent in the POST and FU returns a 200 that the file was uploaded to www.biggytv.com, a bucket that does not exist.
So my issue is the uploadSuccess: {endpoint} is not including any of my form data in the POST.
Thank you.!
The action attribute in the form serves the same purpose as the request.endpoint option. You should leave the request.endpoint option off of your JavaScript configuration. The action attribute will define the S3 endpoint where your files will be uploaded. If you want the file to be sent to "btv_upload_org.s3.amazonaws.com", then that should be the value of the form's action attribute. Again, leave request.endpoint off your JavaScript config.
In your JavaScript config, you can (and must) define a signature.endpoint option. Fine Uploader will send a POST to this endpoint to sign each request before a request is sent to the S3 endpoint defined in the action attribute.
You may also define an uploadSuccess endpoint in your JavaScript config. Fine Uploader will POST to this location when the file is successfully in S3.
You can find all information regarding form support on the associated feature page.

Liferay login via CAS, create account functionality via Login Portlet

We use Liferay 6.1.0, OpenLDAP for storing users, and CAS for SSO. I configured Liferay to use CAS for login. However, login via CAS works only if one clicks the "Sign In" link in the upper right corner. Users can also log in via the Login portlet but that does not use CAS. First I thought I can hide or remove the Login portlet to force the users to log in via CAS, but then I lose the "Create Account" link which is provided by the login portlet. And I need the Create Account functionality of Liferay because it is very practical (it exports new users to the LDAP for instance).
How can I have the cake and eat it? I.e. offer Liferay's Create Account link without showing the rest of the Login portlet, and "force" already registered users logging in via CAS only? Any help would be appreciated. Thanks.
Answering my own question as I finally figured it out...
I created a hook to replace the JSP file $TOMCAT/webapps/ROOT/html/portlet/login/login.jsp where $TOMCAT is the Tomcat server directory in the Liferay bundle. (Check the Liferay guide on how to create JSP hooks.)
The idea is to test whether CAS is enabled, and if yes, then "hide" the username, password fields and the login button in the form. The test condition I found in a Liferay Shibboleth plugin. Here is the relevant part of the JSP, starting from Line 101 or thereabouts:
<liferay-ui:error exception="<%= UserPasswordException.class %>" message="authentication-failed" />
<liferay-ui:error exception="<%= UserScreenNameException.class %>" message="authentication-failed" />
<%-- When CAS is enabled, don't show the normal login fields --%>
<c:choose>
<c:when test="<%= PrefsPropsUtil.getBoolean(company.getCompanyId(), PropsKeys.CAS_AUTH_ENABLED, PropsValues.CAS_AUTH_ENABLED) %>" >
<%-- CAS is enabled --%>
<div><p>
Please sign in via CAS using the "Sign In" link in the upper right corner.
</p></div>
</c:when>
<c:otherwise> <%-- original login fields --%>
<aui:fieldset>
<%
String loginLabel = null;
if (authType.equals(CompanyConstants.AUTH_TYPE_EA)) {
loginLabel = "email-address";
}
else if (authType.equals(CompanyConstants.AUTH_TYPE_SN)) {
loginLabel = "screen-name";
}
else if (authType.equals(CompanyConstants.AUTH_TYPE_ID)) {
loginLabel = "id";
}
%>
<aui:input label="<%= loginLabel %>" name="login" showRequiredLabel="<%= false %>" type="text" value="<%= login %>">
<aui:validator name="required" />
</aui:input>
<aui:input name="password" showRequiredLabel="<%= false %>" type="password" value="<%= password %>">
<aui:validator name="required" />
</aui:input>
<span id="<portlet:namespace />passwordCapsLockSpan" style="display: none;"><liferay-ui:message key="caps-lock-is-on" /></span>
<c:if test="<%= company.isAutoLogin() && !PropsValues.SESSION_DISABLED %>">
<aui:input checked="<%= rememberMe %>" inlineLabel="left" name="rememberMe" type="checkbox" />
</c:if>
</aui:fieldset>
<aui:button-row>
<aui:button type="submit" value="sign-in" />
</aui:button-row>
</c:otherwise>
</c:choose>
<%-- end of CAS-dependent login field part --%>
</aui:form>
Admittedly it is a hack but it works. :-)