[Svn] r5974 - in trunk/plugins/password: . drivers

trac at roundcube.net trac at roundcube.net
Wed Mar 7 11:01:32 CET 2012


Author: alec
Date: 2012-03-07 04:01:32 -0600 (Wed, 07 Mar 2012)
New Revision: 5974

Added:
   trunk/plugins/password/drivers/domainfactory.php
Modified:
   trunk/plugins/password/README
   trunk/plugins/password/package.xml
Log:
- Added domainfactory driver (#1487882)


Modified: trunk/plugins/password/README
===================================================================
--- trunk/plugins/password/README	2012-03-07 09:48:33 UTC (rev 5973)
+++ trunk/plugins/password/README	2012-03-07 10:01:32 UTC (rev 5974)
@@ -40,6 +40,7 @@
  2.12. LDAP - no PEAR (ldap_simple)
  2.13. XMail (xmail)
  2.14. Pw (pw_usermod)
+ 2.15. domainFACTORY (domainfactory)
  3.	Driver API
 
 
@@ -261,6 +262,13 @@
  See config.inc.php.dist file for configuration description.
 
 
+ 2.15.  domainFACTORY (domainfactory)
+ -----------------------------------
+
+ Driver for the hosting provider domainFACTORY (www.df.eu).
+ No configuration options.
+
+
  3. Driver API
  -------------
 

Added: trunk/plugins/password/drivers/domainfactory.php
===================================================================
--- trunk/plugins/password/drivers/domainfactory.php	                        (rev 0)
+++ trunk/plugins/password/drivers/domainfactory.php	2012-03-07 10:01:32 UTC (rev 5974)
@@ -0,0 +1,70 @@
+<?php
+
+/**
+ * domainFACTORY Password Driver
+ *
+ * Driver to change passwords with the hosting provider domainFACTORY.
+ * See: http://www.df.eu/
+ *
+ * @version 2.0
+ * @author Till Krüss <me at tillkruess.com>
+ * @link http://tillkruess.com/projects/roundcube/
+ *
+ */
+
+class rcube_domainfactory_password
+{
+    function save($curpass, $passwd)
+    {
+	    $rcmail = rcmail::get_instance();
+
+	    if (is_null($curpass)) {
+		    $curpass = $rcmail->decrypt($_SESSION['password']);
+	    }
+
+    	if ($ch = curl_init()) {
+    		// initial login
+	    	curl_setopt_array($ch, array(
+		    	CURLOPT_RETURNTRANSFER => true,
+    			CURLOPT_URL => 'https://ssl.df.eu/chmail.php',
+	    		CURLOPT_POST => true,
+		    	CURLOPT_POSTFIELDS => array(
+			    	'login' => $rcmail->user->get_username(),
+				    'pwd' => $curpass,
+    				'action' => 'change'
+	    		)
+		    ));
+
+    		if ($result = curl_exec($ch)) {
+    			// login successful, get token!
+	    		$postfields = array(
+		    		'pwd1' => $passwd,
+			    	'pwd2' => $passwd,
+				    'action[update]' => 'Speichern'
+    			);
+
+    			preg_match_all('~<input name="(.+?)" type="hidden" value="(.+?)">~i', $result, $fields);
+	    		foreach ($fields[1] as $field_key => $field_name) {
+		    		$postfields[$field_name] = $fields[2][$field_key];
+			    }
+
+    			// change password
+	    		$ch = curl_copy_handle($ch);
+		    	curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
+			    if ($result = curl_exec($ch)) {
+    				if (strpos($result, 'Einstellungen erfolgreich') !== false) {
+	    				return PASSWORD_SUCCESS;
+		    		}
+    			} else {
+	    			return PASSWORD_CONNECT_ERROR;
+		    	}
+    		} else {
+	    		return PASSWORD_CONNECT_ERROR;
+		    }
+    	} else {
+	    	return PASSWORD_CONNECT_ERROR;
+	    }
+
+    	return PASSWORD_ERROR;
+    }
+}

Modified: trunk/plugins/password/package.xml
===================================================================
--- trunk/plugins/password/package.xml	2012-03-07 09:48:33 UTC (rev 5973)
+++ trunk/plugins/password/package.xml	2012-03-07 10:01:32 UTC (rev 5974)
@@ -28,6 +28,7 @@
 	<notes>
 - Added pw_usermod driver (#1487826)
 - Added option password_login_exceptions (#1487826)
+- Added domainfactory driver (#1487882)
     </notes>
 	<contents>
 		<dir baseinstalldir="/" name="/">



More information about the svn mailing list