1
を使用してログイン私は 幼虫5 |複数の識別子
- ユーザ名
- または電子メールIDを提供することで、ユーザのログインを聞かせしたい
FacebookやLinkedInでの動作と似ています。
Laravel 5.2のデフォルト認証を使用してこれを達成するには、どのような方法が最適ですか?
を使用してログイン私は 幼虫5 |複数の識別子
FacebookやLinkedInでの動作と似ています。
Laravel 5.2のデフォルト認証を使用してこれを達成するには、どのような方法が最適ですか?
私の知る限り、第三者の解決策はありません。 ここに私がどのようにしているかという私の実例があります... postLogin
いくつかのサンプルコードです。
$credentials = $this->getCredentials($request);
$credentials_username = ['username'=>$credentials['username'], 'password'=>$credentials['password']];
$credentials_email = ['email'=>$credentials['username'], 'password'=>$credentials['password']];
$credentials_phone = ['phone'=>$credentials['username'], 'password'=>$credentials['password']];
//adedd custom, we also want to check by username too
if (Auth::attempt($credentials_email, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
//also check for the username if exists then login to the system
}elseif (Auth::attempt($credentials_username, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
//also check for phone no
}elseif (Auth::attempt($credentials_phone, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
あなたは、デフォルトの認証 –
をさらに開発(拡張)することができます。ちょうどそこに拡張/より良い方法があるのだろうかと思っていました。 –
私は知っている限り私が知っている限り、そして最善の方法は、自分自身を行うことです、そうでなければサードパーティの認証を使用する必要があります –