Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EZP-30383: Change password with "legacy_mode: false" does not pro… #139

Merged
merged 1 commit into from
Apr 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kernel/classes/datatypes/ezuser/ezusertype.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function onPublish( $contentObjectAttribute, $contentObject, $publishedNodes )
* @param eZUser $user
* @return string
*/
private function serializeDraft( eZUser $user )
public static function serializeDraft( eZUser $user )
{
return json_encode(
array(
Expand Down
26 changes: 26 additions & 0 deletions kernel/user/ezuseroperationcollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,12 @@ static public function password( $userID, $newPassword )
$user->setAttribute( 'password_hash', $newHash );
$user->setAttribute( 'password_hash_type', $type );
$user->store();

// "Draft" must be in sync with the PersistentObject
self::updateUserDraft( $user );

eZContentCacheManager::clearContentCacheIfNeeded( $userID );

return array( 'status' => true );
}
else
Expand All @@ -326,6 +332,26 @@ static public function password( $userID, $newPassword )
}
}

/**
* Update the "draft" of a given user
*
* @param $user eZUser
*/
static private function updateUserDraft( $user )
{
$userObject = eZContentObject::fetch( $user->id() );

foreach ( $userObject->dataMap() as $attribute )
{
if ( $attribute->ContentClassAttributeIdentifier == 'user_account' )
{
$attribute->setAttribute( 'data_text', eZUserType::serializeDraft( $user ) );
$attribute->store();
break;
}
}
}

/**
* Generate forgotpassword object
*
Expand Down