Password rule to checking against single character term - passwords

We have a password rule that checks against user attributes. The problem is that sometimes the attribute may be a single character like 'a'. In this case any password that contains 'a' will be rejected. How is this usually handled? Length check against the attribute value?

Length check sounds great! Make sure the attribute is over 5 characters (3? 4? 6?) long and contained in the password before you reject it. It's your choice.

Related

How to make a Password Validator in Scratch

So I am trying to make a password validator in Scratch where it asks the user to input an answer and then it puts the answer through some criterias and then outputs if it is a valid password or not. The criterias are:
Has at least 8 characters,
Has at least one uppercase letter,
Has at least one lowercase letter,
Has at least one number,
Has at least one special character,
Must contain less than 18 characters.
I tried to make a list first with all the different characters and check if the password contained them, but it doesn't actually work. I looked all over the internet for help on this but no one seems to have done it. The Scratch Wiki does have some stuff about case sensitivity but I haven't really been able to implement it. I really need help and I have been trying for a while now. Thanks.
If you just check if the password contains the list, it will only work if it has every single character of the list in order. If you want to make sure it contains each check, you're probably going to have to make a system that checks each letter for every check, which is a little complex.
Check if <lowercase letter/whatever check> contains(letter(text reading #) of (password))
If it passes this check, continue to the next check and set text reading # to 1. Otherwise, change text reading # by 1.
I assume you'll know how to code this properly, but I just partially phrased in the way a normal human would.
This will repeat until either it reaches the end of the password or it passes the check. it will then do this again, but for a different check. It's hard to explain in text, and this is my first answer, but I hope it helps.
You have to use the operators "contains", "length of" and > operators, from the end of the class. Combine "contains", "or" and "and".

Validation Rule: NULL value

My users would like to enter a value in the NAME attribute of an entity in SQL Server Master Data Services. The valid values must contain zero to six characters. NULL is a valid value.
I have written a validation rule with a action containing a regex to ensure that the value is six or less characters (Name must contain the pattern ^.{0,6}$), but the NULL values get flagged with a "Validation Failed" status. I would like the NULL values to pass the validation test.
Is there a way to do this?
Thanks for your time. I appreciate your help.
I found the answer to my question on another site. I tested it, and it works.
Here it is:
Conditions:
If
MyAttribute contains the pattern .*
Actions:
Then
MyAttribute must contain the pattern ^.{0,6}$
Thanks
Add an "OR Name IS NULL" to the validation rule.

I want to set Password to have 4 characters Minimum

It's in ASP.NET C# programming language, I spend like 4 hours looking for solution, tried many ways but none of it works.
I have textbox which you can type in password and confirm password textbox.
I placed required field validator when user doesn't type anything to let him know he needs to type something, error pops up.
I want to have one more required field validator where it would be told to user that he needs to put 4 characters minimum in password field, if his password is less than 4 characters.
I tried every single possible way that I could come up with and stumble upon, nothing seems to be working!
You can also try DataAnnotations. apply the following lines of code to the Password property of the appropriate Class:
[Required][StringLength(MaxLength = arbitraryMaxLength, MinimumLength = 4)]
Have you tried Custom validator ?
You can do that with a RegularExpressionValidator. Maybe this helps.

How to test for blank text field when using robotframework-selenium?

How can I specify blank/empty value for a text field when using the robotframework-seleniumlibrary with a TSV file? For example, I have the following:
Textfield Value Should Be identifier=name1 Chris
Textfield Value Should Be identifier=name2
I want to test that name2 is blank. I have tried leaving it blank (which returns a message about an incorrect number of arguments. I have tried "", which looks for a pair of quotes, and '' which enters a single quote, and selenium seems to look for that
You can use either a single backslash \ or special variable ${EMPTY} to create an empty string in the test data. User guide has the details: Robot Framework User Guide.
Yes, ${EMPTY} is a built in variable.
There are many examples, see an example here
${EMPTY} is good for a blank value but, surprisingly, it didn't work for an empty value.
I found what I was looking for. The field I was verifying had no value in its value attribute and I wanted to verify it. It was returning '' as the value and when using ${EMPTY} it couldn't find '''' instead. Such a minor thing but ended up solving what I needed, so it depends what you're seeking to verify.

Do I need :presence=>true on my model if I have :length=>{:minimum=>1,:maximum=>255}?

Is having both :presence=>true and length validation on my rails model redundant? Or is there a reason to have both?
Those validations do not do the same.The only difference is that if you just leave the validation checking the length you could still fill the field with spaces (from 1 to 255).
With the presence validation spaces are not taken a character