wintercms / wintercms/wn-user-plugin

Password length?

Open
#22 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Question
Dominant language
PHP
Stars
13
Forks
20
Avg merge
50m
Merged PRs (30d)
1

Description

Hi. The documentation says:

Password length requirements
By default, the User plugin requires a minimum password length of 8 characters for all users when registering or changing their password. You can change this length requirement by going to backend and navigating to System > Users > User Settings. Inside the Registration tab, a Minimum password length field is provided, allowing you to increase or decrease this limit to your preferred length.

There are no fields on the registration tab that set the minimum number. But minimun length i find in config.php.
User model has rules. And validation has nothing to do with the config

 'password' => 'required:create|between:8,255|confirmed',

image

fields.yaml in settings model:

# ===================================
#  Field Definitions
# ===================================

tabs:
    fields:
        # Throttle Sign In
        use_throttle:
            span: left
            label: winter.user::lang.settings.use_throttle
            comment: winter.user::lang.settings.use_throttle_comment
            type: switch
            tab: winter.user::lang.settings.signin_tab

        # Prevent concurrent sessions
        block_persistence:
            span: right
            label: winter.user::lang.settings.block_persistence
            comment: winter.user::lang.settings.block_persistence_comment
            type: switch
            tab: winter.user::lang.settings.signin_tab

        # Login Attribute
        login_attribute:
            span: left
            label: winter.user::lang.settings.login_attribute
            commentAbove: winter.user::lang.settings.login_attribute_comment
            type: radio
            tab: winter.user::lang.settings.signin_tab

        # Remeber Login Mode
        remember_login:
            span: right
            label: winter.user::lang.settings.remember_login
            commentAbove: winter.user::lang.settings.remember_login_comment
            type: radio
            tab: winter.user::lang.settings.signin_tab

        # Require Activation
        allow_registration:
            span: left
            label: winter.user::lang.settings.allow_registration
            comment: winter.user::lang.settings.allow_registration_comment
            type: switch
            tab: winter.user::lang.settings.registration_tab

        # Enable registration throttling
        use_register_throttle:
            span: right
            label: winter.user::lang.settings.use_register_throttle
            comment: winter.user::lang.settings.use_register_throttle_comment
            type: switch
            tab: winter.user::lang.settings.registration_tab

        # Require Activation
        require_activation:
            span: left
            label: winter.user::lang.settings.require_activation
            comment: winter.user::lang.settings.require_activation_comment
            type: switch
            tab: winter.user::lang.settings.activation_tab

        # Activation Mode
        activate_mode:
            span: left
            commentAbove: winter.user::lang.settings.activate_mode_comment
            label: winter.user::lang.settings.activate_mode
            type: radio
            tab: winter.user::lang.settings.activation_tab

User modal also has method :

public static function getMinPasswordLength()
    {
        return Config::get('winter.user::minPasswordLength', 8);
    }

use only on reset password and signin.

image

upd:
Sorry I didn't see beforeValidate method where change rules with minLength from config.
But its not work beacuse validation rules in onRegister method in Account component take rules from property, before beforeValidate.

image

If I'm wrong, I apologize

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the password rule in config.php and the User model's getMinPasswordLength method, then trace the Account component's onRegister rules and beforeValidate hook. Compare that flow with the fields.yaml settings definition and the documented registration setting. Done means the configured minimum password length, registration validation, and documentation agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.