Exemplo n.º 1
0
 public function createNew($email)
 {
     $newUser = new FrontendUser();
     $newUser->username = $email;
     $newUser->email = $email;
     $password = PasswordGenerator::createSimple();
     $newUser->password = $password;
     try {
         if ($newUser->save()) {
             EmailManager::sendUserInfo($newUser, $password);
         }
     } catch (Exception $e) {
         return $this->checkIfExists($email);
     }
     return $newUser;
 }
Exemplo n.º 2
0
 public function actionCreateTestUser($email)
 {
     /* add demo users */
     $demoUser = new FrontendUser();
     $demoUser->username = "******";
     $demoUser->email = $email;
     $password = $email . '123';
     $demoUser->password = $password;
     $demoUser->save();
     echo 'Ошибки:';
     VarDumper::dump($demoUser->errors);
     if (sizeof($demoUser->errors) == 0) {
         echo '<h1>Новый пользователь успешно создан</h1>';
         echo '<h2>Логин:' . $email . '</h2>';
         echo '<h2>Пароль:' . $password . '</h2>';
     }
 }