Custom validatation for specific password requirements of company - asp-classic

I am using jQuery-Validation-Engine and hoping to find a custom[passsword] logic that I can add to jquery.validationEngine-en.js that will check for multiple criteria all at once (Requirements: 9 MinChars, 1 UpperCase, 1 LowerCase, 1 Numeric, and 1 SpecialChar). I do not know javascript well enough to even attempt this. I have searched and have been surprised it is not already out there. And possibly it has to be numerous individual ones ? like minSize and maxSize used together in
input type="password" name="password1" id="password1" size="44" maxlength="44"
class="validate[required,minSize[8],maxSize[10],custom[password]]"
This is the EMAIL Check
"email": {
"regex": /^(([^<>()[\]\\.,;:\s#\"]+(\.[^<>()[\]\\.,;:\s#\"]+)*)|(\".+\"))#((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
"alertText": "* Invalid email address"
What Would the PASSWORD one look like ?
"password": {
"regex": ,
"alertText": "* Invalid password"
I would ideally like it to Alert for the specifc item that is not being input (ie:) No Upper Case Letter, No Numberic, No Spcecial Character, etc.
Thanks In Advance

Well, baptism by fire, but got er done. I had to break these up, which is really what I wanted to do anyways, so that individual Alert Texts could be used for the different criteria required and not one general invalid password message. With the help of regexlib.com I was able to add numerous custom validations within jquery.validationEngine-en.js The minSize[n] and required are already built into the jQuery Validation, so not showing those.
"minLowerAlphaChars": {
// requires at least one lower case alpha character
"regex": /^(.*[a-z].*)/,
"alertText": "* Must include 1 lowercase character"
},
"minUpperAlphaChars": {
// requires at least one UPPER case alpha character
"regex": /^(.*[A-Z].*)/,
"alertText": "* Must include 1 uppercase character"
},
"minSpecialChars": {
// requires at least one SPECIAL character of the list in regex
"regex": /^(?=.*[!##$%&*()_+}])/,
"alertText": "* Must include 1 special character"
},
"minNumberChars": {
// requires at least one NUMERIC
"regex": /^(?=.*\d)/,
"alertText": "* Must include 1 numberic"
},
"noFirstNumber": {
// requires first charecter NOT be NUMERIC
"regex": /^(?!\d)/,
"alertText": "* First Character can not be numberic"
},
Usage;
<input type="password" class="validate[required,minSize[8],custom[minNumberChars],custom[minSpecialChars],custom[noFirstNumber],custom[minUpperAlphaChars],custom[minLowerAlphaChars]]" name="password1" id="password1" size="44">

Related

Extracting values with jq only when they exist

I have a large file of records that contain fields that look something like this:
{
"id": "1000001",
"updatedDate": "2018-12-21T01:52:00Z",
"createdDate": "1993-11-30T02:59:25Z",
"varFields": [
{
"fieldTag": "b",
"content": "1000679727"
},
{
"fieldTag": "v",
"content": "v.1"
}
}
I need to extract the .content element along with other things, but only when the fieldTag associated with it is "v". Only some records contain a fieldTag "v".
When I try to parse using
(.varFields[] |select(.fieldTag=="v") | "\(.content)") // ""
it works fine so long as v is present. However, when it is not present, I get
jq: error (at <stdin>:353953): Cannot iterate over null (null)
I tried to get rid of the error with multiple variations, including things to the effect of
(select((.varFields[] |select(.fieldTag=="v") | .content) != null) | .varFields[] |select(.fieldTag=="v") | "\(.content)") // ""
but I'm still getting the same error. What am I missing?
Take a look at the error suppression operator ? that works a bit like the new ?. nullable chaining operator in Javascript.
The ? operator, used as EXP?, is shorthand for try EXP.
Example:
jq '[.[]|(.a)?]'
Input [{}, true, {"a":1}]
Output [null, 1]
They have a slightly simpler demonstrable example of this at https://jqplay.org/jq?q=%5B.%5B%5D%7C(.a)%3F%5D&j=%5B%7B%7D%2C%20true%2C%20%7B%22a%22%3A1%7D%5D and the try-catch operator is similar if all you need is custom error handling (or just error ignoring...).

Extract values from web service JSON response with JSONPath

I have a JSON response from web service that looks something like this :
[
{
"id":4,
"sourceID":null,
"subject":"SomeSubjectOne",
"category":"SomeCategoryTwo",
"impact":null,
"status":"completed"
},
{
"id":12,
"sourceID":null,
"subject":"SomeSubjectTwo",
"category":"SomeCategoryTwo",
"impact":null,
"status":"assigned"
}
]
What I need to do is extract the subjects from all of the entities by using JSONPATH query.
How can I get these results :
Subject from the first item - SomeSubjectOne
Filter on specific subject value from all entities (SomeSubjectTwo for example)
Get Subjects from all entities
Goessner's orinial JSONPath article is a good reference point and all implementations more or less stick to the suggested query syntax. However, implementations like Jayway JsonPath/Java, JSONPath-Plus/JavaScript, flow-jsonpath/PHP may behave a little differently in some areas. That's why it can be important to know what implementation you are actually using.
Subject from the first item
Just use an index to select the desired array element.
$.[0].subject
Returns:
SomeSubjectOne
Specific subject value
First, go for any elements .., check those with a subject [?(#.subject] and use == '..' for comparison.
$..[?(#.subject == 'SomeSubjectTwo')]
Returns
[ {
"id" : 12,
"sourceID" : null,
"subject" : "SomeSubjectTwo",
"category" : "SomeCategoryTwo",
"impact" : null,
"status" : "assigned" } ]*
Get all subjects
$.[*].subject
or simply
$..subject
Returns
[ "SomeSubjectOne", "SomeSubjectTwo" ]

Firebase startAt String only takes first character

I have a structure like below under xyz
{
"pushKey000": {
"findKey": "john_1",
"userName": "john",
"topic": 1
},
"pushKey001": {
"findKey": "john_2",
"userName": "john",
"topic": 2
},
"pushKey002": {
"findKey": "joel_1",
"userName": "joel",
"topic": 1
}
}
Now am trying to make a query where I want data of all entries with findKey starting with "john". I tried the following:(Using REST for example)
https://abc.firebaseio.com/xyz.json?orderBy="findKey"&startAt="john"
This gives me all the results including 'joel'. Basically it just uses the first character of startAt, in this case J.
This firebase video fires the same type of query but only searches with just first character.
Is there something wrong that I am doing or is there is any other way to retrieve it using findKey? Thanks a lot for the help in advance
PS: My .indexOn is on findKey and can't change it
There is nothing wrong with your code, there is something wrong with your expectations. (I always wanted to write that as an answer :))
The startAt() function works as a starting point for your query, not a filter. So in your case it will find the first occurance of "john" and return everything from that point forward (Including Joel, Kevin, Tim, etc...).
Unfortunatly there is no direct way to do a query where findKey contains the string "john". But luckely there is a (partial) workaround using endAt().
You query will look like this:
orderBy="findKey"&startAt="john"&endAt="john\uf8ff"
Here \uf8ff is the last unicode character (please correct me if I'm wrong).
With this you can query for values that start with "john" like "johnnie", "johnn", "john". But not "1john" or "johm" or "joel".

How do I create a Slot that accepts a currency amount

I want to receive a dollar amount in my utterance. So, for example, if I ask Alexa:
Send $100.51 to Kroger.
(pronounced, One hundred dollars and fifty one cents) I want to receive the value 100.51 in a proper slot.
I have tried searching and I defined my utterance slots like this:
"slots": [
{
"name": "Amount",
"type": "AMAZON.NUMBER"
}
]
But on JSON input I only get this result:
"slots": {
"Amount": {
"name": "Amount",
"value": "?"
}
}
How can I make Alexa accepts currency values?
I'm a bit confused by what you wrote in your last sentence and the code, but I'll confirm that there is no built-in intent or slot for handling currency.
So, you'll have to do it manually using AMAZON.NUMBER slot type as you seem to be trying.
I would imagine that you will want to create utterences with two AMAZON.NUMBER slots - one for dollars and one for cents.
Easy, make a custom slot and just use $10.11, $.03, and $1003.84 as the sample's. It will work as currency now, accepting users dollars and cents utterances and converting them to a dollar $XX.XX format.

special character parsing in handlebar using triple braces

I have json in which for a key there is HTML code. In that html code there is special char ($ - dollar).
{
"output": {"agreementText": "test data",
"edgeTerms": [
{
"edgeDeviceName": "Apple® iPhone® 6 Plus 16GB in Gold",
"deviceLabel": null,
"edgeTermsAndCondition": "<h3>RETAIL INSTALLMENT SALE AGREEMENT / RETAIL INSTALLMENT OBLIGATION — SUBJECT TO STATE REGULATION</h3> <p>Price $59 and discount $2</p> "
}
]
}
}
When i am trying to paint json data in html using triple curly braces for HTML parsing like
{{{edgeTermsAndCondition}}}
page goes blank but when i using double curly brace it is painting fine but HTML tags as string, which i don't want.
Please help.

Resources