A Reason Not to Like Notes
I've been working on a user registration "component" for a Domino database. Something to let users register for access and then, once logged in, change their passwords.
As part of both processes the password entered is validated and checked it's of a certain quality. It has to be a certain length as well as containing both uppercase and lowercase letters along with some numbers. So, "P4ssw0rD" is ok but "p4ssw0rd" and "P4SSW0RD" aren't.
I needed to perform this validation both in @Formula and LotusScript.
The @Formula is simple:
@Length(Password)>6 & @Matches(Password; "*{A-Z}*") & @Matches(Password; "*{a-z}*") & @Matches(Password; "*{0-9}*")
It would follow that the LotusScript equivalent would be:
If Len(doc.Password(0))>6 And doc.Password(0) Like "*[A-Z]*" And doc.Password(0) Like "*[a-z]*" And doc.Password(0) Like "*#*" Then
But, wait. It looks like there's a bug in LotusScript which means all the following are True:
"ABCDE" Like "*[a-z]*"
"abcde" Like "*[A-Z]*"
"AbCdE" Like "*[A-Z]*"
The only way round this I've found is to use the whole alphabet, like so:
If Len(doc.Password(0))>6 And doc.Password(0) Like "*[ACBDEFGHIJKLMNOPQRSTUVWXYZ]*" And doc.Password(0) Like "*[acbdefghijklmnopqrstuvwxyz]*" And doc.Password(0) Like "*#*" Then
You've got to like love Notes! An hour of my day wasted...
I know the feeling.
Of course, all other options other than Notes are not bug free either. Maybe an hour isn't too bad compared to some other tools?
Reply
I'm not sure it's a bug...
By default, string comparisons in LotusScript are case-insensitive, and "like" is a kind of string comparision...
What happens if you put in "Option compare Case" before you start comparing?
Reply
Forget what I said... "Option Compare Case" seems to be the default anyway ...
Reply
Show the rest of this thread
Hi,
if you use "Option Compare Binary" the Like-Operator works correctly.
Sven
Reply
Regular Expressions are always a great way to test passwords
LotusScript
http://lekkimworld.com/2005/09/25/1127661564236.html
LotusScript
http://www.openntf.org/projects/pmt.. ..70053f5cd/468846f664e3212c862577a50053b3ff!OpenDocument
Javascript in the client
http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256C4F005D3717
Reply
Never liked the idea of using either ls2j or createobject in LS. I'd rather just rewrite the whole agent in java!
Reply
Forget about anything serious about regular expressions in LS. Just use Java and LJ2J if you need to work with LS. Tommy Valand wrote about it http://dontpanic82.blogspot.com/2007/10/simple-ls2j-regular-expression-class.html. It has served me well.
Reply
Ummm.....
Why not just Evaluate() the same @Formula?
Dim s as String
s = |
@Length(Password)>6 & @Matches(Password; "*{A-Z}*")
& @Matches(Password; "*{a-z}*") & @Matches(Password; "*{0-9}*")
|
Dim vResult as Variant
vResult = Evaluate(s, yourDoc)
Print (vResult(0))
Reply
Because evalaute() is cheating.
Reply
Show the rest of this thread
Hi Jake, You need to love Notes, I am not gonna tell you how many hours I wasted in that other M.... world ;-) where you needs A4 pages of code while the @formula is just within a page rule length.
LOVE NOTES
Reply