Case-insensitive Logins #1194
-
I need to support case-insensitive usernames and emails on the frontend. These fields in the users table can be easily constrained in my PostgreSQL database with unique indexes (see: http://shuber.io/case-insensitive-unique-constraints-in-postgres/). It seems like extendUserQuery() in Manager.php may be the right place to tweak the relevant where clause, possibly by adding one or more ->orWhereRaw() conditions, but I am struggling to make this work. A solution, an example or some advice would be very helpful! Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@SpherAx I would certainly be happy for us to support case-insensitive username/emails across the board, if you were interested in providing a pull request for that. However, if you just want to do it for your own project, you could create a new plugin, and then as part of the use Illuminate\Support\Facades\App;
public function register()
{
App::singleton('user.auth', function () {
return \Your\Plugin\Classes\AuthManager::instance();
});
} You would be correct, in your own implementation of the Make sure to make the User plugin a requirement of your custom plugin, so that it loads first, and your |
Beta Was this translation helpful? Give feedback.
@SpherAx I would certainly be happy for us to support case-insensitive username/emails across the board, if you were interested in providing a pull request for that.
However, if you just want to do it for your own project, you could create a new plugin, and then as part of the
register()
method in your plugin, you could overwrite theuser.auth
singleton bind to point to your own version of theAuthManager
.You would be correct, in your own implementation of the
AuthManager
class, you can overwrite/extend thee…