2016-11-25 56 views
0

目前,我們正在使用auto auth,我們有下面的方法登錄的用戶自動使用有電子郵件,問題是當電子郵件有一個plus sign它不會自動登錄。WHMCS自動權威性

/** 
* @param $email Clients Email Address to Login 
* @param string $goto is a url endpoint where you want to redirect the user 
*/ 
public static function autoLoginUser($email, $goto = 'index.php?m=dashboard') 
{ 
    global $CONFIG; 

    /** 
    * Define WHMCS url and AuthKey from confguration.php 
    */ 
    $whmcsurl = $CONFIG['SystemURL'] . "/dologin.php"; 
    $autoauthkey = "Our auth key is here"; //$autoauthkey from configuration.php 

    $timestamp = time(); //Get current timestamp 
    $hash = sha1($email . $timestamp . $autoauthkey); //Generate Hash 

    /** 
    * Generate AutoAuth URL & Redirect 
    */ 
    $url = $whmcsurl . "?email=$email&timestamp=$timestamp&hash=$hash&goto=" . urlencode($goto); 
    header("Location: $url"); 
    exit; 
} 

有沒有人試過這個?有一個正常的電子郵件地址完美的作品,但對包含加號的電子郵件,它不會自動登錄用戶。

+0

不知道,但嘗試用%2B替換+的電子郵件當WHMCS從電子郵件創建slug時逃脫url,這可能是編碼器的問題。 –

+0

你好@LukaSvalina我試過那個,但它沒有工作。我會發布對我們的案件有用的東西。 –

回答

2

我不知道爲什麼它沒有在WHMCS證明,但我們周圍的管理有工作編碼的電子郵件如下面的代碼

/** 
* @param $email Clients Email Address to Login 
* @param string $goto is a url endpoint where you want to redirect the user 
*/ 
public static function autoLoginUser($email, $goto = 'index.php?m=dashboard') 
{ 
    global $CONFIG; 

    /** 
    * Define WHMCS url and AuthKey from confguration.php 
    */ 
    $whmcsurl = $CONFIG['SystemURL'] . "/dologin.php"; 
    $autoauthkey = "Our auth key is here"; //$autoauthkey from configuration.php 

    $timestamp = time(); //Get current timestamp 
    $hash = sha1($email . $timestamp . $autoauthkey); //Generate Hash 
    $email = 
    /** 
    * Generate AutoAuth URL & Redirect 
    */ 
    $url = $whmcsurl . "?email=".urlencode($email)."&timestamp=$timestamp&hash=$hash&goto=" . urlencode($goto); 
    header("Location: $url"); 
    exit; 
}