Allow email addressed for member username

Before I go crazy editing core Statamic files I'm hoping I can sense-check something...

By default, members in Statamic require a username (this is used for the filename). I was hoping to add a little bit of JS that autocompleted the username field with the persons email address so they can login using their email address (like what the Lodge does). However, trying to enter an email address as a username throws an error - but if I manually change the filename it all seems to work file and login with email works...

So, it appears I just need to disable Statamic's default error handling for usernames, possibly (but not tested yet) these lines:


// is this a valid username?
if (!self::isValidusername($username)) {
        throw new Exception(Localization::fetch('invalid_username'));


// validate username if it was set
if (!isset($errors['username']) && $username !== $original_username && !Member::isValidUsername($username)) {
    $errors['username'] = Localization::fetch('invalid_username');

My question is, has anyone done this already or can anyone see any potential issues with this that I might be overlooking? Seems to work fine when the filename is, for example [email protected] and my login form works... all seems possible - Any thoughts? Is there a more elegant way of doing this rather than editing core files?

>>>>>>> Unanswered <<<<<<<
10 Replies