Changes a user's email
@param int $uid
@param string $email
@param string $password
@param string $captcha = null
@return array $return
485112
public function changeEmail($uid, $email, $password, $captcha = null)
    {
        $return['error'] = true;
        $block_status = $this->isBlocked();

        if ($block_status == "verify") {
            if ($this->checkCaptcha($captcha) == false) {
                $return['message'] = $this->__lang("user_verify_failed");

                return $return;
            }
        }

        if ($block_status == "block") {
            $return['message'] = $this->__lang("user_blocked");

            return $return;
        }

        $validateEmail = $this->validateEmail($email);

        if ($validateEmail['error'] == 1) {
            $return['message'] = $validateEmail['message'];

            return $return;
        }

        if ($this->isEmailTaken($email)) {
            $this->addAttempt();
            $return['message'] = $this->__lang("email_taken");

            return $return;
        }

        $validatePassword = $this->validatePassword($password);

        if ($validatePassword['error'] == 1) {
            $return['message'] = $this->__lang("password_notvalid");

            return $return;
        }

        $user = $this->getBaseUser($uid);

        if (!$user) {
            $this->addAttempt();
            $return['message'] = $this->__lang("system_error") . " #14";

            return $return;
        }

        if (!password_verify($password, $user['password'])) {
            $this->addAttempt();
            $return['message'] = $this->__lang("password_incorrect");

            return $return;
        }

        if ($email == $user['email']) {
            $this->addAttempt();
            $return['message'] = $this->__lang("newemail_match");

            return $return;
        }

        $query = "UPDATE {$this->config->table_users} SET email = ? WHERE id = ?";
        $query_prepared = $this->dbh->prepare($query);
        $query_prepared->execute([$email, $uid]);

        if ($query_prepared->rowCount() == 0) {
            $return['message'] = $this->__lang("system_error") . " #15";

            return $return;
        }

        $return['error'] = false;
        $return['message'] = $this->__lang("email_changed");

        return $return;
    }
1154887
public function updateTheAuthenticatedUser($email = null)
	{
		$data = array();
		if(!is_null($email))
			$data['email'] = $email;
		
		return $this->client->request("/user", 'PATCH', $data, 200, 'GitHubPrivateUser');
	}
557978
public function changePassword($username, $password)
    {
        $user = $this->findUserByUsernameOrThrowException($username);
        $user->setPlainPassword($password);
        $this->userManager->updateUser($user);

        $event = new UserEvent($user, $this->getRequest());
        $this->dispatcher->dispatch(Events::USER_PASSWORD_CHANGED, $event);
    }
375465
public function getChange($email, $token) {
		//todo check email / token combo
		if (!$user = DB::table(config('center.db.users'))->whereNull('deleted_at')->where('email', $email)->where('token', $token)->first()) {
			return redirect()->action('\LeftRight\Center\Controllers\LoginController@getReset')->with([
				'error'=>trans('center::site.password_change_error')
			]);
		}

		return view('center::login.change', [
			'email'=>$email,
			'token'=>$token,
		]);
	}
1201158
public function updateUser($userLogin, $password = '', $email = '', $alias = '', array $optional = [])
    {
        return $this->_request('UsersManager.updateUser', [
            'userLogin' => $userLogin,
            'password' => $password,
            'email' => $email,
            'alias' => $alias,
        ], $optional);
    }
1346244
protected function _onEmailChange($email, $updateOrInsert = 'insert') {
        $authVars = Garp_Auth::getInstance()->getConfigValues('validateemail');

        // See if validation of email is enabled
        if (empty($authVars['enabled']) || !$authVars['enabled']) {
            return;
        }
        $validationTokenColumn = $authVars['token_column'];
        $emailValidColumn = $authVars['email_valid_column'];

        // Fetch fresh user data by email
        $users = $this->fetchAll(
            $this->select()->from(
                $this->getName(),
                array('id', 'email', $validationTokenColumn, $emailValidColumn)
            )
                ->where('email = ?', $email)
        );

        // Generate validation token for all the found users
        foreach ($users as $user) {
            $this->invalidateEmailAddress($user, $updateOrInsert);
        }
    }
994619
def request_password_change_mail(self, password):
        
        message = Msg(EMsg.ClientRequestChangeMail, extended=True)
        message.body.password = password

        resp = self.send_job_and_wait(message, timeout=10)

        if resp is None:
            return EResult.Timeout
        else:
            return EResult(resp.eresult)
894223
public function update($id, $first_name, $last_name, $email, $active, $password = null)
	{
		$user = $this->find($id);

		// Not very clean
		if (trim($password) != '')
		{
			$password = Hash::make($password);
		}
		else
		{
			unset($password);
		}

		$user->fill(compact('first_name', 'last_name', 'email', 'password', 'active'))->save();

		return $user;
	}
479394
protected function secureEmailChange() {
    $this->defaultEmailChange();
    /** @var Token $token */
    $token = Yii::createObject([
      'class' => Token::className(),
      'userId' => $this->user->id,
      'type' => Token::TYPE_CONFIRM_OLD_EMAIL,
    ]);
    $token->save(false);
    $this->mailer->sendReconfirmationMessage($this->user, $token);

    // unset flags if they exist
    $this->user->flags &= ~User::NEW_EMAIL_CONFIRMED;
    $this->user->flags &= ~User::OLD_EMAIL_CONFIRMED;
    $this->user->save(false);

    Yii::$app->session->setFlash('info', Yii::t('users', 'We have sent confirmation links to both old and new email addresses. You must click both links to complete your request'));
  }
1091366
public function actionIndex($email, $password)
    {
        $user = UserModel::findByEmail($email);

        if ($user === null) {
            $this->stdout(Yii::t('yii2mod.user', 'User is not found.') . "\n", Console::FG_RED);
        } else {
            if ($user->resetPassword($password)) {
                $this->stdout(Yii::t('yii2mod.user', 'Password has been changed.') . "\n", Console::FG_GREEN);
            } else {
                $this->stdout(Yii::t('yii2mod.user', 'Error occurred while changing password.') . "\n", Console::FG_RED);
            }
        }

        return self::EXIT_CODE_NORMAL;
    }
76058
public OvhTaskPop delegatedAccount_email_changePassword_POST(String email, String password) throws IOException {
		String qPath = "/email/domain/delegatedAccount/{email}/changePassword";
		StringBuilder sb = path(qPath, email);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "password", password);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhTaskPop.class);
	}
883580
public function setEmailPassword($email, $password)
    {
        if (isset($this->apikey)) {
            throw new \Exception(
                "ApiKey already set."
            );
		}
		$this->emailPassword = $email.': '.$password;
		return $this;
    }
1248797
public function createUserWithEmailAndPassword($email, $password): UserRecord
    {
        return $this->createUser(
            Request\CreateUser::new()
                ->withUnverifiedEmail($email)
                ->withClearTextPassword($password)
        );
    }
473167
@POST
  @Path("me/email")
  @RolesAllowed({"ROLE_ADMIN", "ROLE_USER"})
  public Response changeEmail(@Context HttpServletRequest request, EmailRequest emailRequest) {
    Long userId = (Long) request.getAttribute(OAuth2Filter.NAME_USER_ID);
    return changeEmail(userId, emailRequest);
  }
1282419
protected function passwordReset($email)
    {
        if (empty($email)) {
            throw new BadRequestException("Missing required email for password reset confirmation.");
        }

        /** @var User $user */
        $user = User::whereEmail($email)->first();

        if (null === $user) {
            // bad code
            throw new NotFoundException("The supplied email was not found in the system.");
        }

        static::isAllowed($user);

        // if security question and answer provisioned, start with that
        $question = $user->security_question;
        if (!empty($question)) {
            return ['security_question' => $question];
        }

        // otherwise, is email confirmation required?
        $user->confirm_code = Registrar::generateConfirmationCode(\Config::get('df.confirm_code_length', 32));
        $user->save();

        $sent = $this->sendPasswordResetEmail($user);

        if (true === $sent) {
            return ['success' => true];
        } else {
            throw new InternalServerErrorException(
                'No security question found or email confirmation available for this user. Please contact your administrator.'
            );
        }
    }
215027
public function createUser($email, $password, $role=User::ROLE_RECRUITER, $fullname="Test Recruiter")
    {
        /* @var Register $service */
        /* @var User $user */
        $repo = $this->getUserRepository();
        $user = $repo->create([]);
        $user->setLogin($email);
        $user->setPassword($password);
        $user->setRole($role);
        $settings = $user->getSettings('Applications');
        
        $expFullName = explode(' ', $fullname);
        $info = $user->getInfo();
        $info->setFirstName(array_shift($expFullName));
        $info->setLastName(count($expFullName)>0 ? implode(' ', $expFullName):'');
        $info->setEmail($email);
        $info->setEmailVerified(true);
        $repo->store($user);
        $repo->getDocumentManager()->refresh($user);
        
        $eventArgs = new LifecycleEventArgs($user, $repo->getDocumentManager());
        $repo->getDocumentManager()->getEventManager()->dispatchEvent(
            Events::postLoad,
            $eventArgs
        );
        /* @var \Core\EventManager\EventManager $events */
        /* @var \Auth\Listener\Events\AuthEvent $event */
        //@TODO: [Behat] event not working in travis
        //$events = $this->coreContext->getEventManager();
        //$event  = $events->getEvent(AuthEvent::EVENT_USER_REGISTERED, $this);
        //$event->setUser($user);
        //$events->triggerEvent($event);
        return $user;
    }
821272
public function takeAction($type, $uids=array(), $component='', $element=null)
	{
		// Do we have the proper bits?
		if (!$element || !$component || !$type)
		{
			return false;
		}

		// Do we have any user IDs?
		if (count($uids) > 0)
		{
			// Loop through each ID
			foreach ($uids as $uid)
			{
				// Find any actions the user needs to take for this $component and $element
				$action = Action::blank();
				$mids = $action->getActionItems($component, $element, $uid, $type);

				// Check if the user has any action items
				if (count($mids) > 0)
				{
					$recipient = Recipient::blank();
					if (!$recipient->setState(1, $mids))
					{
						$this->setError(Lang::txt('Unable to update recipient records %s for user %s', implode(',', $mids), $uid));
					}
				}
			}
		}

		return true;
	}