示例#1
0
 /**
  * @dataProvider encodeWithSecretNoSaltProvider
  */
 public function testEncodeWithSecretNoSalt($input, $secret)
 {
     $this->setExpectedException('RZ\\Roadiz\\Core\\Exceptions\\EmptySaltException');
     $code = StringHandler::encodeWithSecret($input, $secret);
     // Assert
     $this->assertEquals($input, StringHandler::decodeWithSecret($code, $secret));
 }
 /**
  * @param  Request $request
  * @return string
  */
 protected function getReceiver(Request $request)
 {
     /*
      * Custom receiver
      */
     if (!empty($request->get('form')['_emailReceiver'])) {
         $email = StringHandler::decodeWithSecret($request->get('form')['_emailReceiver'], $this->getService('config')['security']['secret']);
         if (false !== filter_var($email, FILTER_VALIDATE_EMAIL)) {
             return $email;
         }
     }
     return SettingsBag::get('email_sender');
 }