Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
15 Jul 2021 at 18:49 UTC
Updated:
27 Nov 2021 at 09:24 UTC
Jump to comment: Most recent
Comments
Comment #2
abdulaziz zaidComment #3
rajeshreeputraThe code looks good and works as well. No issue found.
Comment #4
3ssom commentedI think this is a RTBC.
Comment #5
avpadernoSetting
$this->configFactoryis already done from the parent class. Neither of those methods are necessary, in a class extendingConfigFormBase.Either
parent::buildForm()isn't called at the end of the method, or it's isn't called at the beginning of the method. I would look at the code used from Drupal core classes that extendConfigFormBaseto understand whenparent::buildForm()should be called.$this->configFactory->getEditable('unwanted_email_registration.settings')must be replaced from$this->config('unwanted_email_registration.settings')which already returns an editable configuration object.The second call to
$this->config('unwanted_email_registration.settings')isn't necessary. (Since the code already obtained an editable configuration object, it doesn't need another editable configuration object for the same configuration.)The documentation comment for a class should not just repeat the class name. Also, the class name used to implement a service, in Drupal core, doesn't end with Service.
The documentation comment for a method needs to document its parameters. It is also not correct, as CustomService isn't the class name.
The messenger service isn't used from the service and it should not be one of its parameters.
Since that class doesn't extend another class, nor does it implement an interface, the documentation comment for the method cannot just contain
{@inheritdoc}as that isn't an inherit method.This is could be either a wrong variable name or wrong logic used from the code. From the array name, it seems that
$allowedcontains the allowed domain names. If this is the case, why is the code returningTRUEwhich means the email is valid?if (in_array($domain, $allowed)) {isn't really necessary, as the method exits when the value$domainisn't contained in the$allowedarray.Modules should never directly query the database table for an entity. Drupal has a class to query the entity values in the database.
Comment #6
abdulaziz zaidDear apaderno,
Thank you for your testing.
Return TRUE, if not exists Email to continue registration.
Return FALSE, if Email exists.
What is the class? gave me an example.
Comment #7
marijan gudeljI think he is referring to the clas EntityQuery
Comment #8
rajeshreeputraComment #9
avpadernoComment #10
avpadernoLine 1 checks the
$domainvalue is not in the$allowedarray; if it isn't, it returnsTRUE. This means that when line 2 is executed, the$domainvalue is surely in the$allowedarray and checking it is in the array is useless.Comment #11
abdulaziz zaidThank you.
Issues fixed.
git clone https://git.drupalcode.org/project/unwanted_email_registration.git
Comment #12
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.