/**
  * Callback for the login form.
  *
  * This just calls the core login function and redirects back to us so we can show the link form.
  *
  * @param \Pieform $form Pieform form instance.
  * @param array $values Array of submitted values.
  */
 public function login_submit(\Pieform $form, $values)
 {
     global $USER, $SESSION;
     // Save our OIDC info, because an invalid login will destroy it.
     $oidclinkdata = $SESSION->get('auth_oidc_linkdata');
     try {
         login_submit($form, $values);
     } catch (\AuthUnknownUserException $e) {
         $SESSION->set('auth_oidc_linkdata', $oidclinkdata);
         $SESSION->add_error_msg(get_string('loginfailed'));
         redirect('/auth/oidc/link.php');
     }
     if ($USER->is_logged_in()) {
         redirect('/auth/oidc/link.php');
     } else {
         $SESSION->set('auth_oidc_linkdata', $oidclinkdata);
         if (empty($_SESSION['messages'])) {
             $SESSION->add_error_msg(get_string('loginfailed'));
         }
         redirect('/auth/oidc/link.php');
     }
 }
Example #2
0
        $back_url = 'index.php?n=index&h=add_vip&s_cid=' . $user_arr['s_cid'];
    } else {
        $back_url = 'index.php?n=index&h=add_vip';
    }
    if (!$user_arr['s_cid']) {
        header("location:index.php?n=login&back_url=" . urlencode($back_url));
    } else {
        $s_cid = MooGetGPC('s_cid', 'int', 'R');
    }
    require MooTemplate('public/add_vip', 'module');
}
/***************************************   控制层(C)   ****************************************/
//print_r($_COOKIE);
switch ($_GET['h']) {
    case "submit":
        login_submit();
        break;
    case "logout":
        login_logout();
        break;
    case "holiday":
        index_holiday();
        break;
    case "govip":
        index_govip();
        break;
    case "add_vip":
        index_add_vip();
        break;
    default:
        index_index();