DEV Community

Michael Brooks
Michael Brooks

Posted on

2 1

Laravel enforcing strict passwords with Regex

Recently I had someone comment on one of my gists which I created a few years ago. It was a gist to help create strict password validation with Regex. I honestly completely forgot about it until that email.

When taking a look, I thought to myself "Oh wow! Did I make this?". I then looked down at the comments which I never saw before and noticed it's helped out quite a lot of people.

I thought it was only fair I should share it to others in case they need it to. So without further ado, here's the link for your viewing pleasure.

https://gist.github.com/Michael-Brooks/fbbba105cd816ef5c016

There are some very helpful comments, so please feel free to read them and I hope it helps you out for your Laravel projects. And if you create something useful in your own code, don't forget to share it in a gist as it could help others.

If you have your very own useful gists, please feel free to share too.

UPDATE: It's been noted that this could be seen as a recommendation or "this is how I think passwords should be done". It isn't and these were requirements from a former client which had been formally agreed upon. I would recommend better password validation rules and using a password strength indicator. This can be seen on my Reddit post here

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more