![](/img/trans.png)
[英]How to change default username/email/password for Authentication on LARAVEL 5?
[英]Change the default Authentification fields (email ,password ) in Laravel
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string("code_massar");
$table->date("date_naissance");
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
我在 laravel 中找到了一種方法 5
檢查這篇文章。 它與 ldap 一起使用,但我認為它應該有用https://ldaprecord.com/docs/laravel/v2/auth/database/laravel-breeze/#introduction
Go 驗證您的 LoginController 方法並根據需要修改它
public function authenticate(Request $request)
{
$credentials = $request->validate([
'code_massar' => ['required'],
'date_naissance' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('dashboard');
}
return back()->withErrors([
'code_massar' => 'The provided code_massar do not match our records.',
'date_naissance' => 'The provided date_naissance do not match our records.',
]);
}
你可以在這里看到更多https://laravel.com/docs/9.x/authentication#authenticating-users
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.