예제 #1
0
파일: User.php 프로젝트: hmlb/user-bundle
 /**
  * Change the email address of the user.
  *
  * @param string $email
  */
 public function changeEmail(string $email)
 {
     Assertion::email($email);
     $oldEmail = $this->email;
     $this->email = $email;
     $this->emailCanonical = self::canonicalize($this->email);
     $this->updated = new DateTime();
     $this->record(new EmailChanged($this->getId(), $oldEmail, $this->email));
 }
예제 #2
0
파일: User.php 프로젝트: hmlb/userbundle
 /**
  * @param string                       $username
  * @param string                       $email
  * @param string                       $plainPassword
  * @param UserPasswordEncoderInterface $encoder
  * @param array                        $roles
  */
 protected function __construct(string $username, string $email, string $plainPassword, UserPasswordEncoderInterface $encoder, array $roles = [])
 {
     Assertion::email($email);
     $this->id = new Identity();
     $this->roles = $roles;
     $this->salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
     $this->created = new DateTime();
     $this->username = $username;
     $this->email = $email;
     $this->updateCanonicalFields();
     $this->updatePassword($plainPassword, $encoder);
 }