Beispiel #1
0
 /*
  * first time here: we show only the password and passwordcheck fields
  */
 /*
  * Data validation
  */
 $token = DataValidator::validate_action_token($_GET['tok']);
 $userid = DataValidator::is_uinteger($_GET['uid']);
 if ($token == false || $userid == false) {
     /*
      * Token or userid not valid, do not proceed.
      */
     header('Location: ' . HTTP_ROOT_DIR);
     exit;
 }
 $tokenObj = TokenFinder::findTokenForUserRegistration($userid, $token);
 if ($tokenObj == false) {
     /*
      * There isn't a token corresponding to input data, do not proceed.
      */
     $message = translateFN('Did not find a token that matches your request');
     header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message));
     exit;
 }
 $userObj = MultiPort::findUser($userid);
 if ($userObj instanceof ADAUser) {
     // se stato != preiscritto mostrare un messaggio adeguato
     if ($userObj->getStatus() != ADA_STATUS_PRESUBSCRIBED) {
         $message = translateFN('Forse un utente con questi dati ha già confermato la tua registrazione');
         //      $message = translateFN('Maybe a user with these data has already confirmed his/her registration to ADA');
         header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message));
Beispiel #2
0
$token = DataValidator::validate_action_token($_GET['token']);
/*
 * If a valid course id was not given, do not proceed.
 * (Note: we are not checking $id_course !== false,
 *  since we do not accept as valid a course id set to 0)
 */
if ($id_course != false) {
    if ($r_id_user != false && $token !== false) {
        /*
         * Handle a subscription request made by a user that has also asked for registration.
         * To proceed, we have to check that the given token exists for this user and that
         * the token is valid too.
         * Additionally we have to check that the user has been correctly registered and
         * that needs to confirm his/her registration.
         */
        $tokenObj = TokenFinder::findTokenForUserRegistration($r_id_user, $token);
        if ($tokenObj === false || !$tokenObj->isValid()) {
            /*
             * There isn't a token corresponding to input data, do not proceed.
             */
            $message = translateFN('An error occurred while processing your request. Try later');
            header('Location: ' . HTTP_ROOT_DIR . '/index.php?message=' . urlencode($message));
            exit;
        }
        $userObj = MultiPort::findUser($r_id_user);
        if ($userObj instanceof ADAUser && $userObj->getStatus() == ADA_STATUS_PRESUBSCRIBED) {
            $isRegistration = TRUE;
        } else {
            /*
             * Wrong type of user or wrong user status. Do not proceed.
             */
Beispiel #3
0
 case "form_password":
     /*
      * Second time here.
      * Show the password change form.
      */
     $token = DataValidator::validate_action_token($_GET['tok']);
     $userid = DataValidator::is_uinteger($_GET['uid']);
     if ($token == false || $userid == false) {
         /*
          * Invalid data in input
          */
         $error_page = HTTP_ROOT_DIR . "/browsing/forget.php";
         $errObj = new ADA_Error($requestInfo, translateFN('It was impossible to confirm the password change'), NULL, NULL, NULL, $error_page . '?message=' . urlencode(translateFN('It was impossible to confirm the password change')));
         exit;
     }
     $tokenObj = TokenFinder::findTokenForPasswordChange($userid, $token);
     if ($tokenObj === false) {
         /*
          * There isn't a token corresponding to input data, do not proceed.
          */
         $error_page = HTTP_ROOT_DIR . "/browsing/forget.php";
         $errObj = new ADA_Error($requestInfo, translateFN('It was impossible to confirm the password change'), NULL, NULL, NULL, $error_page . '?message=' . urlencode(translateFN('It was impossible to confirm the password change')));
         exit;
     }
     $userObj = MultiPort::findUser($userid);
     if (AMA_DataHandler::isError($userObj)) {
         $error_page = HTTP_ROOT_DIR . "/browsing/forget.php";
         $errObj = new ADA_Error($userType, translateFN('It was impossible to confirm the password change: user unknown'), NULL, NULL, NULL, $error_page . '?message=' . urlencode(translateFN('It was impossible to confirm the password change: user unknown')));
         exit;
     }
     if ($tokenObj->isValid()) {