Exemplo n.º 1
0
 public function actionVerify($id, $hash)
 {
     $request = $this->loadModel($id);
     if ($hash == $request->hash) {
         $mglist = Mglist::model()->findByPk($request->mglist_id);
         // insert new Member
         $member_id = $request->insertMember($request->name, $request->address);
         // add member to this list
         Member::model()->addToList($member_id, $request->mglist_id);
         // add member at Mailgun
         $yg = new Yiigun();
         $yg->memberAdd($mglist->address, $request->address, $request->name);
         $this->render('verify', array('model' => $this->loadModel($id), 'mglist' => $mglist));
     } else {
         echo 'Sorry, your request is invalid.';
         yexit();
     }
 }
Exemplo n.º 2
0
$config = dirname(__FILE__) . '/../../hybridauth/config.php';
require_once "../../hybridauth/Hybrid/Auth.php";
// check for erros and whatnot
$error = "";
if (isset($_GET["error"])) {
    $error = '<b style="color:red">' . trim(strip_tags($_GET["error"])) . '</b><br /><br />';
}
// if user select a provider to login with
// then inlcude hybridauth config and main class
// then try to authenticate te current user
// finally redirect him to his profile page
if (isset($_GET["provider"]) && $_GET["provider"]) {
    echo ' got here';
    var_dump($_GET['provider']);
    var_dump(Yii::app()->user);
    yexit();
    try {
        // create an instance for Hybridauth with the configuration file path as parameter
        $hybridauth = new Hybrid_Auth($config);
        // set selected provider name
        $provider = @trim(strip_tags($_GET["provider"]));
        // try to authenticate the selected $provider
        $adapter = $hybridauth->authenticate($provider);
        // if okey, we will redirect to user profile page
        $hybridauth->redirect("profile.php?provider={$provider}");
    } catch (Exception $e) {
        // In case we have errors 6 or 7, then we have to use Hybrid_Provider_Adapter::logout() to
        // let hybridauth forget all about the user so we can try to authenticate again.
        // Display the recived error,
        // to know more please refer to Exceptions handling section on the userguide
        switch ($e->getCode()) {