コード例 #1
0
ファイル: User.php プロジェクト: ChristopheBrun/hLib
 /**
  * Si on met à jour un email depuis le backend admin, il faut s'assurer que la nouvelle adresse mail sn'est pas déjà prise
  *
  * @param string $attribute the attribute currently being validated
  */
 public function validateUpdatedEmail($attribute)
 {
     if (!$this->hasErrors()) {
         if ($newEmail = hArray::getValue($this->getDirtyAttributes(), 'email')) {
             if (User::findIdentityByEmail($newEmail)) {
                 $this->addError($attribute, HUsers::t('messages', 'This user already exists'));
             }
         }
     }
 }
コード例 #2
0
ファイル: h.php プロジェクト: ChristopheBrun/hLib
 /**
  * Renvoie le protocole de communication à utiliser dans les urls.
  * En dev, on utilise toujours http car aucun certificat autosigné n'est installé sur le poste de développement
  * En production, on utilise https pour les urls sécurisés enregistrées dans la configuration, et http pour les autres
  *
  * @param bool $useSecuredUrls
  * @return string
  */
 public static function protocol($useSecuredUrls = true)
 {
     if ($useSecuredUrls && !YII_ENV_DEV && ($securedUrls = hArray::getValue(Yii::$app->params, 'securedUrls'))) {
         return 'https';
     }
     return 'http';
 }