Login with Username or Email

Hi , Hope have a great day
i need your help to know how can users can login with their username or email address right now they can just login with their email when put username it says invalid login


In Settings:

User > New

Then add their email, name, etc. give permissions and they’re good to go.

By looking at the code, apparently there’s currently no way to login with a user’s username (with the exception of Administrator and Guest accounts). Even the login page (frappe/templates/pages/login.html) expects a user email value:

<form class="form-signin form-login" role="form">
	. . .
	<input type="text" id="login_email"
		class="form-control" placeholder="{{ _('Email address') }}" required autofocus>
	<input type="password" id="login_password"
		class="form-control" placeholder="{{ _('Password') }}" required>
	. . . 

However, I suspect that is a feature that will be implemented in the future, because the username field was not part of the User DocType since the beginning.

EDIT - Actually, the field was added to fulfill some new requirement and not to improve the login process. Here’s the request discussion on GitHub:: Feature Request: Notification when user is mentioned in comment · Issue #3495 · frappe/erpnext · GitHub.