Merge "Restore state if password change fails" into pi-dev