| Author |  | 
      
        | rick_ps Newbie
 
  
 
 Joined: 20 July 2014
 Online Status: Offline
 Posts: 1
 | 
          Hey Guys,
           | Posted: 20 July 2014 at 11:10pm | IP Logged |   |  
           | 
 |  
 I have a pretty unique situation where the username doesn't match the first part of the email address. I've been looking at the Change email-to-username mapping on login plugin, but can't quite figure out what I need to do. It's installed but I'm not sure how to match it with the following situation:
 
 For our email server, you must login with the username with a "cc_" prefix, so for example:
 
 Username: cc_jane
 Email Addresss: jane@domain.com
 
 How can I enable our users to login with either a username OR an email address (but not require both). If I just login with the username, a correct email address isn't added to the account. Currently I'm requiring users to login with both their username and email address but it's a bit cumbersome.
 
 Thank you!
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          You'll need to replace the main function of the plugin with:
           | Posted: 21 July 2014 at 2:07am | IP Logged |   |  
           | 
 |  
 
 
| Code: 
 
    
    | 
      
       | public function PluginIntegratorLoginToAccount(&$sEmail, &$sIncPassword, &$sIncLogin, &$sLanguage) {
 $sIncLogin = "cc_" . \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail);
 }
 |  |  |  
 As you can see, the method used there strips off the domain part with "@" character leaving just the username, and "cc_" bit will be prepended.
 
 Hope this helps!
 
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |