Finish the password reset operation
@param array $data
@return array
166101
protected function resetPasswordFinish(array $data)
    {
        $data['user']['password'] = $data['password'];
        unset($data['user']['data']['reset_password']);

        $this->user->update($data['user']['user_id'], $data['user']);
        $this->mail->set('user_changed_password', array($data['user']));

        return $this->getResultResetPasswordFinish();
    }
1368337
protected function getResultDelete(array $data)
    {
        unset($data['product_id']);

        $existing = $this->wishlist->getList($data);

        return array(
            'message' => '',
            'severity' => 'success',
            'quantity' => count($existing),
            'redirect' => empty($existing) ? 'wishlist' : ''
        );
    }
1163072
protected static function saveExtraParams(array $data)
    {
        $final_data = array();
        if (count($data) > 0) {
            Logger::log('Saving extra configuration parameters');
            foreach ($data as $key => $value) {
                if (null !== $value || $value !== '') {
                    $final_data[$key] = $value;
                }
            }
        }
        return $final_data;
    }
713211
protected function create(array $data)
    {
        $user = UserGate::create([
            'first_name' => $data[ 'first_name' ],
            'last_name'  => $data[ 'last_name' ],
            'username'   => $data[ 'username' ],
            'email'      => $data[ 'email' ],
            'password'   => bcrypt($data[ 'password' ]),
            'enabled'    => 1,
        ]);

        if ($user) {
            $user->attachRole(2);
        }

        return $user;
    }
516589
public static function arrayResolve(array $data)
    {

        $array = [];

        foreach ($data as $provider => $bool) {

            if ($bool === true) {

                $array['required'][] = $provider;

            }
            else {

                $array['hidden'][] = $provider;

            }
        }

        return $array;
    }
1224188
public function changePassword(array $data)
    {
        $currentUser = $this->getAuthService()->getIdentity();

        $oldPass = $data['credential'];
        $newPass = $data['newCredential'];

        $bcrypt = new Bcrypt;
        $bcrypt->setCost($this->getOptions()->getPasswordCost());

        if (!$bcrypt->verify($oldPass, $currentUser->getPassword())) {
            return false;
        }

        $pass = $bcrypt->create($newPass);
        $currentUser->setPassword($pass);

        $this->getEventManager()->trigger(__FUNCTION__, $this, array('user' => $currentUser, 'data' => $data));
        $this->getUserMapper()->update($currentUser);
        $this->getEventManager()->trigger(__FUNCTION__.'.post', $this, array('user' => $currentUser, 'data' => $data));

        return true;
    }
392169
protected function cleanData(array $data): array
    {
        $options = $this->getOptions();

        $disallowedDataKeys = array(
            $options->getIdColumnName(),
            $options->getLeftColumnName(),
            $options->getRightColumnName(),
            $options->getLevelColumnName(),
            $options->getParentIdColumnName(),
        );

        if (null !== $options->getScopeColumnName()) {
            $disallowedDataKeys[] = $options->getScopeColumnName();
        }

        return array_diff_key($data, array_flip($disallowedDataKeys));
    }
843220
protected function create(array $data)
    {
        $user = User::create([
            'uuid' => (string) Str::uuid(),
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);

        return $user;
    }
971326
private function _toCleanArray(array $data)
    {
        switch (count($data)) {
            case 0:
                return null;

            case 1:
                if (isset($data[0])) {
                    // Return array content when only one item
                    // with the key 0.
                    if (is_array($data[0])) {
                        return $this->_toCleanArray($data[0]);
                    } else {
                        return $data[0];
                    }
                }
                break;

            case 2:
                if (isset($data[0], $data[1]) && is_string($data[1])) {
                    if (('info' === $data[1]) || ('warning' === $data[1]) || ('error' === $data[1])) {
                        if (is_array($data[0])) {
                            return $this->_toCleanArray($data[0]);
                        } else {
                            return $data[0];
                        }
                    }
                }
        }
        $output = array();
        foreach ($data as $key => $value) {
            if (is_array($value)) {
                $output[$key] = $this->_toCleanArray($value);
            } else {
                if (is_string($value)) {
                    // Filter passwords from the log
                    if (\MUtil_String::contains($key, 'password', true) || \MUtil_String::contains($key, 'pwd', true)) {
                        $value = '****';
                    }
                } elseif ($value instanceof Zend_Date) {
                    // Output iso representation for date objects
                    $value = $value->getIso();
                }
                $output[$key] = $value;
            }
        }

        return $output;
    }
1365363
protected function preSetHook(&$data)
    {
        // check if we are trying to edit any protected fields,
        // i.e. password or email address, that require the current
        // password to be changed
        $passwordRequired = false;

        foreach ($data as $key => $value) {
            if (static::hasProperty($key)) {
                if (in_array($key, static::$protectedFields)) {
                    // protected fields, i.e. passwords, are not allowed
                    // to be set to empty values
                    if (strlen(implode((array) $value)) == 0) {
                        unset($data[$key]);
                        continue;
                    }

                    $passwordRequired = true;
                }

                $data[$key] = $value;
            }
        }

        // verify the given current password, when required
        $auth = $this->getApp()['auth'];
        if ($passwordRequired && !$this->can('skip-password-required', $auth->getCurrentUser())) {
            $password = array_value($data, 'current_password');
            $strategy = $auth->getStrategy('traditional');
            if (!$strategy->verifyPassword($this, $password)) {
                $this->getErrors()->add('invalid_password');

                return false;
            }
        }

        $this->_changedPassword = isset($data['password']) && !$this->isTemporary();

        return true;
    }
857796
public static function compute(array $data, ?string $password = null): string
	{
		unset($data['signature']);

		if ($password !== null) {
			$data['password'] = $password;
		}

		if (!array_key_exists('password', $data)) {
			throw new MissingParameterException('password');
		}

		if (
			$data['password'] === null
			|| $data['password'] === ''
		) {
			throw new MissingParameterException('password');
		}

		return Digester::process($data);
	}
1199984
protected function _hashPassword(array $data) {
        $config = Zend_Registry::get('config');
        if (!empty($config->auth->adapters->db)) {
            $authVars = $config->auth->adapters->db;
            $credentialColumn = $authVars->credentialColumn;
            $hashMethod       = $authVars->hashMethod;
            $salt             = $authVars->salt;
            if (!empty($data[$credentialColumn])) {
                $data[$credentialColumn] = new Zend_Db_Expr($hashMethod.'(CONCAT('.
                                            $this->getAdapter()->quoteInto('?', $data[$credentialColumn]).
                                            ', '.$this->getAdapter()->quoteInto('?', $salt).'))');
            }
        }
        return $data;
    }
819046
protected function guardResult(array $data): array
    {
        // guard 优先
        if (!empty($this->guard)) {
            return $this->guard($data);
        }

        $guard = $this->getSceneGuard($this->currentScene);

        return empty($guard) ? $data : $this->guardFilter($data, $guard);
    }
1101347
public static function createFromArray(array $data): RetryMap
    {
        $retryMap = new RetryMap();
        foreach ($data as $entry) {
            $retryMap->addRetry(Retry::createFromArray($entry));
        }

        return $retryMap;
    }
300913
public function toRet(array $data = [])
    {
        if ($this->isSuccess()) {
            return $this->suc($data + (array) $this->getResponse());
        }

        $e = $this->getErrorException();
        return $this->err($data + ['code' => $e->getCode(), 'message' => $e->getMessage()]);
    }
155115
protected function credentials(PasswordResetData $data): array
    {
        return [
            'email' => $data->getEmail(),
            'password' => $data->getPassword(),
            'password_confirmation' => $data->getPasswordConfirmation(),
            'token' => $data->getToken()
        ];
    }
1105283
protected function rename(array $data): array
    {
        $result = [];
        foreach ($data as $dataItem) {
            list($keyId, $dataTmp) = $this->getKeyValue($dataItem);

            if ($keyId === null) {
                $result[] = $dataTmp;
            } else {
                $result[$keyId] = $dataTmp;
            }
        }

        return $result;
    }