Password Validation In Laravel with at least one Letters, Numbers, Upper and Lowercase or Symbols.

  Рет қаралды 6,693

Laratips

Laratips

3 жыл бұрын

In this video, we will learn how to validate passwords so that the users registering in our application will have a super-secure password. This password validation was recently added to the core of laravel. We will look at how we can use this feature when registering into laravel.
Let's be friends:
/ aashish_dhamala
Tech stack:
Laravel
PHP

Пікірлер: 14
@Laratips
@Laratips 3 жыл бұрын
You can also append one more rule on this Password validation class called 'uncompromised' and it will validate whether it has appeared in data leak or not.
@Samuel.Mwangi
@Samuel.Mwangi 3 жыл бұрын
In my opinion, uncompromised() is the only rule I will be using going forward. If the password is not compromised yet, it is more secure than most mixed character combinations a user can come up with plus provides for a better UX. If they use the same password on every site they sign up for, it's only a matter of time before the password is unavailable to use.
@Laratips
@Laratips 3 жыл бұрын
Yup, I agree.
@kishoreprasaanth2477
@kishoreprasaanth2477 5 ай бұрын
Thankyou for helping to solve this. Using regex lead to an issue when I used some symbols. This helped us a lot.
@keshavthakur5990
@keshavthakur5990 3 жыл бұрын
Very nice explaining validation, Thanks.
@pwcodigo
@pwcodigo Жыл бұрын
Excelente conteúdo, muito obrigado !
@webmaker1845
@webmaker1845 Жыл бұрын
Super sir thanks ☺️☺️
@pacykarz2009
@pacykarz2009 3 жыл бұрын
What are the keys for the new validation rules to create your own error messages in UserRequest in the function messages(), e.g. for a different language
@Laratips
@Laratips 3 жыл бұрын
I looked into the source code and found that it is using Laravel's __() helper method under the hood. So you can do it like sho: Create en.json file in resources/lang directory and add this code for the english language (This is optional. Just to show that these are the supported messages) { "The :attribute must contain at least one number.": "The :attribute must contain at least one numbers.", "The :attribute must contain at least one uppercase and one lowercase letter.": "The :attribute must contain at least one uppercase and one lowercase letter.", "The :attribute must contain at least one letter.": "The :attribute must contain at least one letter.", "The :attribute must contain at least one symbol.": "The :attribute must contain at least one symbol.", "The given :attribute has appeared in a data leak. Please choose a different :attribute.": "The given :attribute has appeared in a data leak. Please choose a different :attribute." } And if you want to create for another language the create another json file on the same directory (E.g. es.json for Spanish) then modify it like so, { "The :attribute must contain at least one number.": "La contraseña debe contener al menos un número.", // ..... and others } On the right hand side of the json value, you can replace :attribute with password of the specific language like I have done here.
@pacykarz2009
@pacykarz2009 3 жыл бұрын
@@Laratips Until now, in the xx.json file I keep the translations of messages used in many blade views, and the specific error messages of the entered data in the appropriate Request files for the Model. I will have to break this rule for UserRequest :)
@Laratips
@Laratips 3 жыл бұрын
Haha. Its the only way now. Or you can send a pull request to Laravel or raise an issue 😁
@Sub-lb7uq
@Sub-lb7uq Жыл бұрын
Thanks for the video, is it possible to add something like Password::min(8)->letters()->numbers()->mixedCase()->symbols()
@novocanal7153
@novocanal7153 Жыл бұрын
Not working 😞
@Laratips
@Laratips Жыл бұрын
I should work. For more details you can check the Laravel's official documentation.
Refactor If else Statements Using Polymorphism -  Part 3
13:52
Laratips
Рет қаралды 2,7 М.
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 69 МЛН
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 38 МЛН
Amazing weight loss transformation !! 😱😱
00:24
Tibo InShape
Рет қаралды 63 МЛН
Faster Eloquent: Avoid Accessors with Foreach
9:35
Laravel Daily
Рет қаралды 52 М.
5 Laravel Relationship Tips That You Might Not Know About
8:21
The Story of Next.js
12:13
uidotdev
Рет қаралды 559 М.
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 69 МЛН