Beispiel #1
0
 private function build($email = '', $password = '')
 {
     //creation object UsersORM
     $this->orm = R::dispense('foxfwusers');
     $this->orm->clef = FoxFWCrypte::randomString(20);
     $this->orm->password = FoxFWCrypte::crypte($password, $this->orm->clef);
     $this->orm->email = $email;
     $this->orm->roles = 'ANONYME';
     $this->orm->etat = true;
     $this->orm->info_co = 'Undefined';
 }
Beispiel #2
0
 private static function securityFormSend()
 {
     //token des formulaires
     if (!isset($_SESSION['form_token'])) {
         $_SESSION['form_token'] = FoxFWCrypte::randomString(20);
     }
     if (count($_POST) > 0) {
         //verifier que le token existe dans le formulaire
         if (isset($_POST['tf_t']) && isset($_POST['tf_u'])) {
             if ($GLOBALS['User']->isLogin()) {
                 $clef = FoxFWCrypte::decrypte($_POST['tf_u'], $_SESSION['form_token']);
                 if ($clef != $GLOBALS['User']->getClef()) {
                     sleep(10);
                     FoxFWKernel::loadRouter('index');
                 }
             }
             if ($_POST['tf_t'] != $_SESSION['form_token']) {
                 sleep(3);
                 FoxFWKernel::loadRouter('index');
             }
         } else {
             die('Security: Error Form !');
         }
         //recharge du token
         $_SESSION['form_token'] = FoxFWCrypte::randomString(20);
     }
 }