[Hastymail-cvs] SF.net SVN: hastymail: [132] trunk/hastymail2
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2008-01-27 06:20:46
|
Revision: 132 http://hastymail.svn.sourceforge.net/hastymail/?rev=132&view=rev Author: sailfrog Date: 2008-01-26 22:20:44 -0800 (Sat, 26 Jan 2008) Log Message: ----------- append domain name on login site option Modified Paths: -------------- trunk/hastymail2/index.php trunk/hastymail2/lib/utility_classes.php Modified: trunk/hastymail2/index.php =================================================================== --- trunk/hastymail2/index.php 2008-01-27 05:59:51 UTC (rev 131) +++ trunk/hastymail2/index.php 2008-01-27 06:20:44 UTC (rev 132) @@ -56,6 +56,7 @@ /* setup site options */ $user =& new fw_user(); +$user->append_login_domain = false; $user->cookie_domain = ''; $user->cookie_path = '/'; $user->cookie_name = 'hastymail2'; @@ -177,7 +178,7 @@ ob_start(); build_page($pd); output_filtered_content(ob_get_clean(), $hm_tags); -//$imap->puke(); +$imap->puke(); /* end */ $user->clean_up(); Modified: trunk/hastymail2/lib/utility_classes.php =================================================================== --- trunk/hastymail2/lib/utility_classes.php 2008-01-27 05:59:51 UTC (rev 131) +++ trunk/hastymail2/lib/utility_classes.php 2008-01-27 06:20:44 UTC (rev 132) @@ -586,11 +586,9 @@ function md5_hash($string) { return '{MD5}'.base64_encode(pack('H*', md5($string))); } - function do_auth() { + function do_auth($user, $pass) { global $imap; $return = false; - $user = trim($_POST['user']); - $pass = trim($_POST['pass']); $imap->connect(); if ($user && $pass && $imap->connected) { return $imap->authenticate($user, $pass); @@ -644,14 +642,22 @@ } function check_session() { global $user; + global $domain; if (isset($_POST['user']) && isset($_POST['pass']) && isset($_POST['login'])) { $this->login_attempt = true; - if ($this->do_auth()) { + if ($user->append_login_domain && !strstr($_POST['user'], '@')) { + $username = trim($_POST['user']).'@'.$domain; + } + else { + $username = trim($_POST['user']); + } + $pass = trim($_POST['pass']); + if ($this->do_auth($username, $pass)) { $this->start_session(); $this->logged_in = true; $_SESSION['user_data'] = array( - 'username' => $_POST['user'], - 'pass' => $user->string_crypt($_POST['pass']) + 'username' => $username, + 'pass' => $user->string_crypt($pass) ); $this->just_logged_in = true; } @@ -757,6 +763,7 @@ var $random_session_id; var $cookie_domain; var $cookie_name; + var $append_logi_domain; var $cookie_path; var $username; var $sticky_url; @@ -804,6 +811,7 @@ $this->cookie_domain = false; $this->site_key = false; $this->cookie_name = false; + $this->append_login_domain = false; $this->cookie_path = false; $this->form_vals = array(); $this->str = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |