Beispiel #1
0
 public function newUser(UserModel $user)
 {
     $token = $user->getPasswordResetToken();
     $values = array('firstname' => $user->firstname, 'lastname' => $user->lastname, 'email' => $user->email, 'admin' => $user->admin, 'token' => $token);
     $message = $this->createNewMessage('Welcome', array($user->email), 'new_user', $values);
     @$this->mailer->send($message);
 }
Beispiel #2
0
 public function run()
 {
     $this->_init();
     $users = new UserModel();
     $info = $users->userLogin($this->data['id']);
     $this->echoView($info);
 }
Beispiel #3
0
 /**
  * @param \stdClass $user
  * @throws DuplicateNameException
  */
 public function add(\stdClass $user)
 {
     try {
         $this->userModel->add(['username' => $user->username, 'email' => $user->email, 'password' => Passwords::hash($user->password), 'first_name' => $user->firstName, 'last_name' => $user->lastName]);
     } catch (UniqueConstraintViolationException $e) {
         throw new DuplicateNameException();
     }
 }
 /**
  * Run user seed.
  */
 public function create()
 {
     $user = new User();
     $user->name = "Anderson Costa";
     $user->email = "*****@*****.**";
     $user->password = '******';
     $user->save();
 }
 public function login($username, $password)
 {
     try {
         $model = new UserModel($this->context->getService('database.default.context'));
         return $model->authenticate(array(0 => $username, 1 => $password));
     } catch (\Exception $ex) {
         $this->sendErrorResource($ex);
     }
 }
Beispiel #6
0
 public function testAdminUser()
 {
     $user = $this->model->findByCredentials('*****@*****.**', 'passwd');
     $expected = '$6$5ygXjBO2gNbW$p1eaS7isBLD1JfN6PaQzrGKJHf9UGmUOBCZiqq3VnhDSPhdbIzOnu3kbKO2mcKEFiD11jFoPE5YSyvA7cYbbK1';
     $this->assertEquals($expected, $user->password);
 }
Beispiel #7
0
 public function run()
 {
     $users = new UserModel();
     $info = $users->userLogin($this->data['id']);
     return $info;
 }