Skip to content
Snippets Groups Projects

Add validation constraints to user.settings

Closes #3436164

Merge request reports

Members who can merge are allowed to add commits.
Code Quality is loading
Test summary results are being parsed
Ready to merge by members who can write to the target branch.
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
51 - 'visitors'
52 - 'admin_only'
53 - 'visitors_admin_approval'
44 54 cancel_method:
45 55 type: string
46 56 label: 'When cancelling a user account'
57 nullable: true
58 constraints:
59 NotBlank:
60 allowNull: true
47 61 password_reset_timeout:
48 62 type: integer
49 63 label: 'Password reset timeout'
64 constraints:
65 Range:
66 min: 0
  • 43 45 label: 'Who can register accounts?'
    46 # Choices are derived from the constants.
    47 # @see \Drupal\user\UserInterface
    48 constraints:
    49 Choice:
    50 choices:
    51 - 'visitors'
    52 - 'admin_only'
    53 - 'visitors_admin_approval'
    44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 nullable: true
    58 constraints:
    59 NotBlank:
    60 allowNull: true
  • omkar podey added 1 commit

    added 1 commit

    Compare with previous version

  • 44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 nullable: true
    58 constraints:
    59 Choice:
    60 - user_cancel_block
    61 - user_cancel_block_unpublish
    62 - user_cancel_reassign
    63 - user_cancel_delete
    64 NotBlank:
    65 allowNull: true
    47 66 password_reset_timeout:
    48 67 type: integer
    49 68 label: 'Password reset timeout'
    69 # A reasonable time would be 10 minutes.
  • 44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 nullable: true
    58 constraints:
    59 Choice:
    60 - user_cancel_block
    61 - user_cancel_block_unpublish
    62 - user_cancel_reassign
    63 - user_cancel_delete
    64 NotBlank:
    65 allowNull: true
    47 66 password_reset_timeout:
    48 67 type: integer
    49 68 label: 'Password reset timeout'
    69 # A reasonable time would be 10 minutes.
  • 41 43 register:
    42 44 type: string
    43 45 label: 'Who can register accounts?'
    46 # Choices are derived from the constants.
    47 # @see \Drupal\user\UserInterface
    48 constraints:
    49 Choice:
    50 choices:
    51 - 'visitors'
    52 - 'admin_only'
    53 - 'visitors_admin_approval'
    44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 nullable: true
  • 48 constraints:
    49 Choice:
    50 choices:
    51 - 'visitors'
    52 - 'admin_only'
    53 - 'visitors_admin_approval'
    44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 nullable: true
    58 constraints:
    59 Choice:
    60 - user_cancel_block
    61 - user_cancel_block_unpublish
    62 - user_cancel_reassign
    63 - user_cancel_delete
  • omkar podey added 1 commit

    added 1 commit

    Compare with previous version

  • omkar podey added 1 commit
  • omkar podey added 1 commit

    added 1 commit

    Compare with previous version

  • 41 43 register:
    42 44 type: string
    43 45 label: 'Who can register accounts?'
    46 # Choices are derived from the constants.
    47 # @see \Drupal\user\UserInterface
  • 49 Choice:
    50 choices:
    51 - 'visitors'
    52 - 'admin_only'
    53 - 'visitors_admin_approval'
    44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 constraints:
    58 Choice:
    59 callback: 'Drupal\user\Plugin\Validation\Constraint\UserCancelMethodsConstraints::getCancelMethodChoices'
    47 60 password_reset_timeout:
    48 61 type: integer
    49 62 label: 'Password reset timeout'
    63 # After a bit of research, 20 minutes seemed appropriate as it
    64 # gives enough time to even access a mail account with MFA.
  • 2
    3 namespace Drupal\user\Plugin\Validation\Constraint;
    4
    5 /**
    6 * Gets the cancel methods.
    7 */
    8 class UserCancelMethodsConstraints {
    9
    10 /**
    11 * Gets the cancel methods.
    12 */
    13 public static function getCancelMethodChoices():array {
    14 return user_cancel_methods(TRUE);
    15 }
    16
    17 }
  • omkar podey added 1 commit

    added 1 commit

    • 0bf000e3 - reduce time + create constraint

    Compare with previous version

  • omkar podey added 1 commit

    added 1 commit

    Compare with previous version

  • omkar podey added 1 commit

    added 1 commit

    Compare with previous version

  • 48 constraints:
    49 Choice:
    50 choices:
    51 - 'visitors'
    52 - 'admin_only'
    53 - 'visitors_admin_approval'
    44 54 cancel_method:
    45 55 type: string
    46 56 label: 'When cancelling a user account'
    57 constraints:
    58 UserCancelMethod: []
    47 59 password_reset_timeout:
    48 60 type: integer
    49 61 label: 'Password reset timeout'
    62 # Any higher value could break sites using a lower value.
    63 # Harden this in a follow-up.
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading