2016-11-25 1 views
0

우리는 현재 auto auth을 사용하고 있습니다. 아래에 이메일을 사용하여 자동으로 로그인하는 방법이 있습니다. 문제는 이메일에 plus sign이 자동으로 로그인하지 않을 때입니다.Whmcs auto auth

/** 
* @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가 이메일에서 슬러그를 생성하고 엔코더에서 문제가 될 수 있으므로 url을 탈출하십시오. –

+0

HI @ 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; 
}