Shortcut method for signing up a new user.

@param string $email
@param string $password
@param string $username

@return \Hamjoint\Mustard\User
320229
public static function register($email, $password, $username)
    {
        $user = new self();

        $user->email = $email;

        $user->password = bcrypt($password);

        $user->username = $username;

        $user->joined = time();

        $user->save();

        return $user;
    }
373148
public function updatePassword($username, $password)
    {
        /** @var UserInterface|EloquentUser $user */
        if ( ! ($user = $this->sentinel->findByCredentials(['email' => $username]))) {
            return false;
        }

        return $this->sentinel->update($user, ['password' => $password]) instanceof UserInterface;
    }
772659
public function create_user($username, $password, $email, $group = 1, Array $profile_fields = array())
	{
		// prep the password
		$password = trim($password);

		// and validate the email address
		$email = filter_var(trim($email), FILTER_VALIDATE_EMAIL);

		// bail out if we're missing username, password or email address
		if (empty($username) or empty($password) or empty($email))
		{
			throw new \SimpleUserUpdateException('Username, password or email address is not given, or email address is invalid', 1);
		}

		// check if we already have an account with this email address or username
		$duplicate = \Model\Auth_User::query()
			->select(\Config::get('ormauth.table_columns', array()))
			->where('username', '=', $username)
			->or_where('email', '=', $email)
			->get_one();

		// did we find one?
		if ($duplicate)
		{
			// bail out with an exception
			if (strtolower($email) == strtolower($duplicate->email))
			{
				throw new \SimpleUserUpdateException('Email address already exists', 2);
			}
			else
			{
				throw new \SimpleUserUpdateException('Username already exists', 3);
			}
		}

		// do we have a logged-in user?
		if ($currentuser = \Auth::get_user_id())
		{
			$currentuser = $currentuser[1];
		}
		else
		{
			$currentuser = 0;
		}

		// create the new user record
		$user = \Model\Auth_User::forge(array(
			'username'        => (string) $username,
			'password'        => $this->hash_password((string) $password),
			'email'           => $email,
			'group_id'        => (int) $group,
			'last_login'      => 0,
			'previous_login'  => 0,
			'login_hash'      => '',
			'user_id'         => $currentuser,
			'created_at'	  => \Date::forge()->get_timestamp(),
			'updated_at'      => 0,
		));

		// load all additional data, passed as profile fields
		$user->from_array($profile_fields);

		// save the new user record
		try
		{
			$result = $user->save();
		}
		catch (\Exception $e)
		{
			$result = false;
		}

		// and the id of the created user, or false if creation failed
		return $result ? $user->id : false;
	}
610675
public function subscribe(string $email, string $name = '')
    {
        $userList = $this->filter(new IsUserEmail($email))->limit(1)->all();

        $user = $userList[0] ?? new User([
                'email'        => $email,
                'name'         => $name,
                'guid'         => Guid::Generate(),
                'isSubscriber' => 1,
            ]);

        if ((new IsUserSubscriber())->isSatisfiedBy($user)) {
            return null;
        }

        if ($user->id) {
            return $this->update($user->id, ['isSubscriber' => 1]);

        }

        return $this->create($user);
    }
907506
public function setAuthentication($username, $password)
    {
        $this->_mailer->Username = $username;
        $this->_mailer->Password = $password;

        return $this;
    }
267987
public function createUser($name, $emailAddress, $password, $isAdmin = false)
    {
        $user = new User();
        $user->setName($name);
        $user->setEmail($emailAddress);
        $user->setHash(password_hash($password, PASSWORD_DEFAULT));
        $user->setIsAdmin(($isAdmin ? 1 : 0));

        return $this->store->save($user);
    }
340230
protected function newUserModel($username, $password, array $options = [])
    {
        $user           = new User();
        $user->username = $username;
        $user->password = $password;

        foreach ($options as $key => $value) {
            $user->{$key} = $value;
        }

        return $user;
    }
1260229
public function changeEmailPassword($username, $email, $password)
    {
        list($account, $domain) = $this->split_email($email);

        return $this->emailAction('passwdpop', $username, $password, $domain, $account);
    }
957542
public function createAdmin($username, $password, $email)
    {
        return $this->createAccount($username, $password, $email, [], 'ACCOUNT_ADMIN', Admin::class);
    }
550291
public function setAuthorization($username, $password)
    {
        $this->username = $username;
        $this->password = $password;

        return $this;
    }
1317890
public function iHaveUser( $username )
    {
        $email = $this->findNonExistingUserEmail( $username );
        $password = $this->getUserManager()->getDefaultPassword();
        $user = $this->getUserManager()->ensureUserExists( $username, $email, $password );
        $this->addValuesToKeyMap( $email, $user->email );
    }
281268
public function init($email, $password)
    {
        // Email and password. Make sure it's URL-friendly.
        $this->email = urlencode($email);
        $this->password = urlencode($password);

        // Check the login session to make sure it's valid.
        if ($this->check_login()) {
            $this->logged_in = true;
        } else {
            $this->perform_login();
        }
    }
460047
public function create($username, $password, $callbackUrl = '', $email = '', $description = '', $needsLocation = false)
    {
        $data = array(
            'new_account_username' => strtoupper($username),
            'new_account_passcode' => $password,
            'callback_url'         => $callbackUrl,
            'email'                => $email,
            'description'          => $description,
            'needs_location'       => $needsLocation ? 'true' : 'false',
            'api_token'            => $this->apiToken,
        );

        $this->send('accounts/', InternalRequestInterface::METHOD_POST, $data);
    }
734697
public function basicAuthentication(string $username, string $password = ""): HttpRequest
    {
        $this->username = $username;
        $this->password = $password;
        return $this;
    }
446317
public function loadUserByUsername($email)
    {
        if (false === filter_var($email, FILTER_VALIDATE_EMAIL)) {
            throw new UsernameNotFoundException('Email not found');
        }

        $user = $this->userRepository->findOneBy([
            'email' => $email,
        ]);

        if (!$user) {
            throw new UsernameNotFoundException('User with passed email not found');
        }

        return $user;
    }
514313
public function create($first_name, $last_name, $email, $active, $password)
	{
		$password = Hash::make($password);

		return User::create(compact('first_name', 'last_name', 'email', 'password', 'active'));
	}
89929
public function login($username, $password) {
  $query = new \Peyote\Select('users');
  $query->where('username', '=', $username)
        ->limit(1);
  $userdata = $this->db->fetch($query);
  if (!isset($userdata[0])) throw new \Exception('User not found');
  $userdata = $userdata[0];
  $pwhash = $this->passhash($password,$userdata['salt']);
  if ($pwhash != $userdata['password']) throw new \JohnVanOrange\Core\Exception\Invalid('Invalid password');
  //succesfully login
  $sid = $this->getSecureID();
  $this->setCookie('sid', $sid);
  $query = new \Peyote\Insert('sessions');
  $query->columns(['user_id', 'sid', 'last_access'])
        ->values([$userdata['id'],$sid, date('Y-m-d H:i:s')]);
  $this->db->fetch($query);
  //update last access for in user table
  $query = new \Peyote\Update('users');
  $query->set([
               'last_login' => date('Y-m-d H:i:s')
              ])
        ->where('username', '=', $username);
  $this->db->fetch($query);
  return array(
   'message' => 'Login successful',
   'sid' => $sid
  );
 }