Version 1
[yaffs-website] / web / core / modules / user / src / Plugin / Validation / Constraint / ProtectedUserFieldConstraint.php
diff --git a/web/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraint.php b/web/core/modules/user/src/Plugin/Validation/Constraint/ProtectedUserFieldConstraint.php
new file mode 100644 (file)
index 0000000..49b4c54
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace Drupal\user\Plugin\Validation\Constraint;
+
+use Symfony\Component\Validator\Constraint;
+
+/**
+ * Checks if the plain text password is provided for editing a protected field.
+ *
+ * @Constraint(
+ *   id = "ProtectedUserField",
+ *   label = @Translation("Password required for protected field change", context = "Validation")
+ * )
+ */
+class ProtectedUserFieldConstraint extends Constraint {
+
+  /**
+   * Violation message.
+   *
+   * @var string
+   */
+  public $message = "Your current password is missing or incorrect; it's required to change the %name.";
+
+}