XXX Chats

Free sex chat with nude girls

Membership validatingpassword

I just wrote this password validation code function that checks to see if a password will be accepted in AD or not.

I'm not sure this is the best way to do it, but for now it works fine.

In Java8 this would be done with Functions, but, let's use an interface for the moment: In fact, I would personally go for an even more sophisticated approach that also separates the types of results to make changes to the logic even easier.

But this might be over-engineering it at this point. It's a bit more readable and much faster in case logging is off (and most logging is off most of the time). Can't you the returned value instead of the very similar message? like if there isn't an uppercase, but that could get monotonous if you fail the checks one at a time.

So, instead I only returned after checks for things that would halt the rest of the checks entirely, which are That last one is really iffy on whether or not it is redundant, because all of those are being checked twice if one of the checks fails.

but the checks are actually only done once and then the value is stored in a boolean variable so we are only checking the value of the variable now which means that technically the check itself only happens once.

To do all of this I reversed some of the if statements and returned as early as I could without losing functionality or creating monotony.

I also moved the null checking so that it is the first thing that is done, otherwise there will be a Almost everything as been said about your code., but there is at least one last thing to say that is very important, that maaartinus mention in his answer : don't log passwords. In this nature, passwords should be secret and known only to the holder of the account.

I hope when you're storing your password you will do everything to protect it (hash, salt, etc).

The problem is if you logged it, no matter how you protected it when you stored it, it will be logged forever in clear text.

Logs are generally accessible and can be read by people that should probably not see the password of your user.

This is a security issue and could be a severe security issue.

Comments Membership validatingpassword