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.'); }
/** * 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(); }
/** * @return array */ public function getAttributes() { $attributes = parent::getAttributes(); $attributes = array_merge($attributes, $this->oAuthServiceDetails); return $attributes; }
public function beforeCreate() { parent::beforeCreate(); $this->generateSlug($this->email); }