Пример #1
0
 public function createAction()
 {
     $user = new BaseUser();
     $user->email = $this->getOption('email');
     $user->raw_password = $this->getOption('password');
     $user->name = $this->getOption('name');
     $user->save();
     $this->putSuccess('User created');
     $this->pubObject($user->toArray());
     $this->putText('Done.');
 }
Пример #2
0
 /**
  * Authenticates user by e-mail address
  *
  * @param $email
  * @return mixed
  * @throws IdentityNotFoundException
  */
 public function authenticateByEmail($email)
 {
     $user = BaseUser::findFirst([['email' => $email]]);
     if (!$user) {
         throw new IdentityNotFoundException();
     }
     $adapter = new \Vegas\Security\Authentication\Adapter\NoCredential($this->di->get('userPasswordManager'));
     $adapter->setSessionStorage($this->obtainSessionScope());
     $auth = new Authentication($adapter);
     $auth->authenticate($user, null);
     return $auth->getIdentity();
 }
Пример #3
0
 /**
  * @return array
  */
 public function getAttributes()
 {
     $attributes = parent::getAttributes();
     $attributes = array_merge($attributes, $this->oAuthServiceDetails);
     return $attributes;
 }
Пример #4
0
 public function beforeCreate()
 {
     parent::beforeCreate();
     $this->generateSlug($this->email);
 }