public function MailhandlerAuthenticateTokenauth::authenticate in Mailhandler 7.2
Same name and namespace in other branches
- 6.2 modules/mailhandler_tokenauth/plugins/mailhandler/authenticate/MailhandlerAuthenticateTokenauth.class.php \MailhandlerAuthenticateTokenauth::authenticate()
Implements authenticate().
Overrides MailhandlerAuthenticate::authenticate
File
- modules/
mailhandler_tokenauth/ plugins/ mailhandler/ authenticate/ MailhandlerAuthenticateTokenauth.class.php, line 29 - MailhandlerAuthenticateTokenauth class.
Class
- MailhandlerAuthenticateTokenauth
- Authenticate message based on token from tokenauth module.
Code
public function authenticate(&$message, $mailbox) {
list($fromaddress, ) = _mailhandler_get_fromaddress($message['header'], $mailbox);
$uid = 0;
// If user with given email address exists and their token is in the toaddress, allow.
if (($from_user = user_load_by_mail($fromaddress)) && strpos($header->to[0]->mailbox, tokenauth_get_token($from_user->uid)) !== FALSE) {
$uid = $from_user->uid;
}
return $uid;
}