GithubHelp home page GithubHelp logo

flarum-birthdays's Introduction

👋 Hi, I'm Dat Ngo Quoc

I'm a Laravel developer.

Frameworks & Tools working on

Laravel TailwindCSS Vue.js PhpStorm Bootstrap Git

Github Contributes


🌐Socials

Facebook Instagram Twitter


flarum-birthdays's People

Contributors

datlechin avatar dependabot[bot] avatar flarum-bot avatar litalino avatar pplulee avatar rob006 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

pplulee arefhna

flarum-birthdays's Issues

Password recovery: The birthdays field is required

Users cant restore their accounts cause its require Birthdays too, but restore-form didnt have this fields.

When you enter the new password and fill in the confirmation, when you press Save changes with new password you will see "Birthday field is required".

re

"The Birthday Field is Required" after Flarum 1.7.0 upgrade

On my test instance I've upgraded Flarum to 1.7.0. Since then if I attempt to make any profile changes while the setting "Required entering Birthdays" option is selected, I get the error "The Birthday Field is Required" even if a birthday has been entered for my user. I have tried disabling the extension and purging all data for it to start over, but this doesn't seem to have any impact.

Unfortunately I don't know which log file I'd need to look at for more helpful debugging information; none that I've looked at (Flarum's error.log, php's fpm log, or nginx's error/access log) have anything occurring at the same time as the bug, with the exception of the POST attempt from me actually submitting whatever profile changes I was attempting to make.

Fix check Register AddBirthdayValidation.php

public function __invoke(UserValidator $flarumValidator, Validator $validator): void
    {
        $rules = $validator->getRules();

        $isRequired = $this->settings->get('datlechin-birthdays.required')
            && $this->settings->get('datlechin-birthdays.set_on_registration');

        if ($isRequired  && ! $flarumValidator->getUser()) {
            $set_isRequired = 'required';
        } else {
            $set_isRequired = 'nullable';
        }

        $rules['birthday'] = [
            //'nullable',
            //Rule::requiredIf($isRequired && ! $flarumValidator->getUser()),
            $set_isRequired,
            'date_format:Y-m-d',
            'before:today',
            function ($attribute, $value, $fail) {
                if ($value) {
                    $birthday = new DateTime($value);
                    $now = new DateTime();
                    $diff = $now->diff($birthday);
                    if ($diff->y <= (int) $this->settings->get('datlechin-birthdays.min_age')) {
                        $fail($this->translator->trans('datlechin-birthdays.api.invalid_age_message', [
                            'minAge' => (int) $this->settings->get('datlechin-birthdays.min_age')
                        ]));
                    } else if ($diff->y > 100) {
                        $fail($this->translator->trans('datlechin-birthdays.api.invalid_dob_message'));
                    }
                }
            },
        ];

        $validator->setRules($rules);
    }

Optional Year & Age Displaying

Displaying the user's age, and year of birth should be optional. For many users, the day and month alone are enough to show birthdays.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.