Rule: determine if user logged-in with email or username

Would it be possible in a rule to determine whether a user logged in with their email or with username, like from context object? Currently both would result in a successful log-in but it is unclear how to retrieve if user had used his/her email or username.

Just tested and it seems that the username (and also password) are stripped from the request object in context. Checking internally why that is. For the password, I’m sure it’s for security purposes, but not sure about username/email.

Interested on the use case: what would you do with this kind of information, whether he user username or email?

1 Like

@ mathiasconradt
Thanks for checking this out, I understand that the credentials are stripped from the context object for security reasons but it would be great if a parameter would be available indicating if user logged-in by username or by e-mail

What’s the use case around it? Why would you need to know it?
I guess a check for an email pattern vs. non-email pattern isn’t sufficient (of course if users can also enter an email address as username, it’s not reliable)?

Hey there!

As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!

Learn more here!