I may have a question that is under the skill level of your all but i just can't get my head around this:
Let's say i have a login form with the fallowing:
1. A text field where you can use both your email and your username
2. A password field obviously
How you i go about validating that on the server site based of if the input is an email or the username?
Should i use a regex pattern for this to determine if the value is an email and that put in the validator rule or what will you do in this situation?
I think that would be fine especially if you have all your authentication stuff in one place like a service class or command handler. I would however use the filter_var function instead of a regex:
if (filter_var($userId, FILTER_VALIDATE_EMAIL))
{
// auth with email
}
else
{
// auth with some other id
}
@WookieMonster I was thinking of extending the validator class with something like that but i would perfer if there was some allready buildin functionality for determine if one rule should be used over another :)