Example #1
0
 /**
  * Function to test forceLogIn function.
  */
 public function testForceLogIn()
 {
     $obj1 = User::forceLogin("rash");
     //try to force-login this user.
     $test = $this->obj->getUserID() == $obj1->getUserID();
     //check if both of these objects are same.
     $obj1->deleteUser();
     //delete the newly created users.
     $this->assertTrue($test);
 }
Example #2
0
 /**
  * Function for user to log-in forcefully i.e without providing user-credentials.
  * @param string $userID        The user ID that needs to log in
  * @return \phpsec\User         Returns the user object
  * @throws UserNotExistsException   Will be thrown if no user is found with the given ID
  */
 public static function forceLogIn($userID)
 {
     return User::forceLogin($userID);
 }
Example #3
0
 $dbResult = $dblink->query($Query);
 $yesno = '';
 if ($row =& $dbResult->fetchRow(DB_FETCHMODE_ASSOC)) {
     $yesno = "{$row["activated"]}";
 }
 if ($yesno == 'N') {
     $Query = "update " . TABLE_PREFIX . "activation set activated='Y' where (name='" . $aname . "')";
     //echo($Query . "<br>\n");
     $AffectedRows = $dblink->exec($Query);
     if ($AffectedRows == 1) {
         //Enable the user's account
         $Query = "update " . TABLE_PREFIX . "session set Status='normal' where (name='" . $aname . "')";
         //echo($Query . "<br>\n");
         $AffectedRows = $dblink->exec($Query);
         if ($AffectedRows == 1) {
             $user->forceLogin($aname);
             $success = true;
             include 'header.php';
             echo "<h2>" . T_("Account Activation") . "</h2>";
             echo "<p class=\"success\">" . T_("Your account is now activated") . "!</p><p>" . T_("Thank you for registering an account with us") . "!<br>" . sprintf(T_("You can now access your account %sbookmarks</a>"), "<a href=\"books.php\">");
             require_once 'includes/browser.php';
             $browser = new Browser();
             //Check if the browser is Firefox, so we show the extension
             if ($browser->Name == "Firefox") {
                 echo ".</p>";
                 include "includes/ff_extension.php";
             } else {
                 echo " " . T_("or add the bookmarklets in your browser") . ".</p>";
                 echo "<div class=\"content\">";
                 include 'includes/easybook_content.php';
             }