Example #1
0
 public function setPassword($password)
 {
     // store the backtrace
     $bt = debug_backtrace();
     // analyze backtrace to see if importing from fixtures
     $is_importing = false;
     foreach ($bt as $cf) {
         if ($cf['function'] == 'loadData') {
             $is_importing = true;
         }
     }
     // if importing from fixtures
     // AND specifically instructed to import encrypted passwords
     // then just save the encrypted password
     if ($is_importing && $this->getSalt() && sfConfig::get('app_sf_guard_plugin_import_encrypted_passwords', false)) {
         if ($password !== null && !is_string($password)) {
             $password = (string) $password;
         }
         if ($this->password !== $password) {
             $this->password = $password;
             $this->modifiedColumns[] = sfGuardUserPeer::PASSWORD;
         }
     } else {
         parent::setPassword($password);
     }
 }
Example #2
0
 public function validateNewPassword()
 {
     parent::_set('password', $this->getNewPassword());
     $this->setNewPassword(null);
     $this->setNewPasswordCreatedAt(null);
     $this->save();
 }
Example #3
0
 public function save($con = null)
 {
     if ($this->getIsApproved() == true) {
         $this->getProfile()->setIsApproved(true);
     }
     parent::save($con);
 }
 public function save(Doctrine_Connection $conn = null)
 {
     if (is_null($this->_get('username')) && is_null($this->_get('email_address'))) {
         return;
         //throw new sfException('Cannot save User with null username and email!');
     }
     if ($this->isNew() && sfGuardUserTable::getIfValidatedUserHasUsername($this->_get('username'))) {
         throw new sfException('Cannot save user.  This username has already been validated with another user.');
     }
     if (!$this->isNew() && in_array('is_validated', $this->_modified) && !$this->_get('is_validated')) {
         /* The user has been un-validated, probably due to changing their
          * Reddit validation key by username or password.  We need to send
          * them an email about it.
          */
         $parameters = array('user_id' => $this->getIncremented());
         $prefer_html = $this->getPreferHtml();
         $address = $this->getEmailAddress();
         $name = $this->getPreferredName() ? $this->getPreferredName() : $this->getFullName();
         $email = EmailTable::getInstance()->getFirstByEmailTypeAndLanguage('ChangeRedditKey', $this->getPreferredLanguage());
         $subject = $email->generateSubject($parameters);
         $body = $email->generateBodyText($parameters, $prefer_html);
         $from = sfConfig::get('app_email_address', ProjectConfiguration::getApplicationName() . ' <' . ProjectConfiguration::getApplicationEmailAddress() . '>');
         AppMail::sendMail($address, $from, $subject, $body, $prefer_html ? $body : null);
         $this->addLoginMessage('You have changed information relating to your Reddit user and will need to validate your Reddit username again.  Please see your email for more information.');
     }
     parent::save($conn);
 }
Example #5
0
 public function __call($method, $arguments)
 {
     if ($method == 'setId') {
         return $this->set('id', Guid::generateId());
     } else {
         return parent::__call($method, $arguments);
     }
 }
 public function validateNewPassword()
 {
     $profile = $this->getProfile();
     parent::_set('password', $profile->getNewPassword());
     $profile->setNewPassword(null);
     $profile->setNewPasswordCreatedAt(null);
     $profile->save();
 }
Example #7
0
 /**
  * Returns an array containing all permissions, including groups permissions
  * and single permissions.
  *
  * @return array
  */
 public function getAllPermissions()
 {
     if (!$this->_allPermissions) {
         $this->_allPermissions = parent::getAllPermissions();
         $asso_members = AssoMemberTable::getInstance()->getDroits($this->getPrimaryKey())->execute();
         foreach ($asso_members as $asso_member) {
             if ($asso_member->getSemestreId() == sfConfig::get('app_portail_current_semestre')) {
                 $this->_allPermissions[$asso_member->getAsso()->getLogin()] = $asso_member;
             }
         }
     }
     return $this->_allPermissions;
 }
 public function checkPassword($password)
 {
     $algorithm = $this->getAlgorithm();
     if ($algorithm === 'crypt') {
         return crypt($password, $this->getPassword()) === $this->getPassword();
     }
     return parent::checkPassword($password);
 }
Example #9
0
 public function setUp()
 {
     parent::setUp();
     $this->hasMany('EiSubjectAssignment as userAssignmentsSubjects', array('local' => 'id', 'foreign' => 'guard_id'));
 }