This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

imap_auth question

Hello everyone,

I've been trying to get my users to validate against an IMAP4 server and I've found the imap_auth hook very useful. The only problem is that it doesn't work against the IMAP server I use, since the usernames ought to have a suffix. Because of this, and because I found the code of imap_auth rather unreadable, I've decided to hack it a bit. So, now I've got this:


function imap_auth_auth($username, $password, $server) {
  
  if (variable_get('imap_auth_enabled', 0) == 0) {
    return FALSE;
  }

	if ( strpos ( $username, 'domainname.nl' ) === false )
	{
	  $username = $username . '.domainname.nl'; // this is the suffix.
	}

	if ( @imap_open ( '{imap4.myimapserver.nl}/INBOX', $username, $password ) )
	{
	
		watchdog ( 'user', 'User ' . $username . ' validated.' ); // For debugging purposes.
		global $user;
		
	 	return true;
	}
	else
	{
	
		watchdog ( 'user', "nope for user $username, $password on $server." );
	 	return false;
	}

}

This actually works. It will open a connection to imap4.myimapserver.nl, with the username username.domainname.nl and the password.

The logs (watchdog) however tell me a different story:

user 2006-08-18 08:27 Login attempt failed for username@domainname.nl
user 2006-08-18 08:27 succeeded.

As you can see the string 'succeeded' is written to the log, but still the login attempt has failed, while I specifically return true. Does someone know why exactly this doesn't work? Perhaps a global variable like $loggedin or something like this should be set? I've been thinking about that quite a while, but the original imap_auth doesn't seem to do anything else.

how to create <HTML> forms

hi everybody,
I want to create one form for name,address etc how it can be done in my site using drupal

Best way to handle images

I am confused on the best way to handle images. After much research I cannot find a simple way. I want to attach multiple images to a node (either page or cck), generate thumbs/previews, and have the images listed below the node.

Does anyone have a solution to the most common requirement of Drupal.
Thanks...

Anybody know this?

Hi,

Anybody know,

I did visit the page : API reference | Drupal API .
There is a list box with a label: (Function, file or topic name: *).. That looks really cool to me.

I need to know how it works and what is the algrothim design behind this control. Any suggestion?

Free tags promoted to front page :( How to stop it

I have a container that uses free tagging. Every time i create a node and tag it with tags , all the tags get promoted to the front page as well as the node. I dont like this as it just looks like words floating in the page. Is there a setting to make free tags not get promoted ?

Thanks

Q: Top tabs w/ CCK like Profile module?

Is there a way to have tabs at the top of CCK when entering data for the node. I have a lot of forms and I need a way to group the forms together in an easy to understand fashion.

Any help would be much appreciated.

Thanks!

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions