“Valider le mot de passe Laravel” Réponses codées

Validation du mot de passe Laravel

'password' => 'required|
               min:6|
               regex:/^.*(?=.{3,})(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[\d\x])(?=.*[!$#%]).*$/|
               confirmed',
Sleepy Salmon

Laravel valider le mot de passe de changement

<?php
   
namespace App\Http\Controllers;
   
use Illuminate\Http\Request;
use App\Rules\MatchOldPassword;
use Illuminate\Support\Facades\Hash;
use App\User;
  
class ChangePasswordController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }
   
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        return view('changePassword');
    } 
   
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function store(Request $request)
    {
        $request->validate([
            'current_password' => ['required', new MatchOldPassword],
            'new_password' => ['required'],
            'new_confirm_password' => ['same:new_password'],
        ]);
   
        User::find(auth()->user()->id)->update(['password'=> Hash::make($request->new_password)]);
   
        dd('Password change successfully.');
    }
}
Rich Ray

Valider le mot de passe Laravel

        $request->validate([
            'email' =>'required|exists:users',
            'password'=>'required|password'
        ]);
Mohamad

Réponses similaires à “Valider le mot de passe Laravel”

Questions similaires à “Valider le mot de passe Laravel”

Plus de réponses similaires à “Valider le mot de passe Laravel” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code