This pull request includes changes primarily aimed at refactoring the way email domains are extracted and handled, and improving error messaging in the authentication process. The extract-domain package was removed and replaced with a custom getEmailDomain function, which is now used in multiple files. Additionally, the error messaging in the signIn and signUp functions was changed from json.error to json.message.
src/server/controllers/admin/settings.js and src/server/prehandlers/restrict-organization-email.js: Replaced usage of extractDomain with getEmailDomain. [1][2]
src/client/api/authentication.js: Changed the error field in the response object of the signIn and signUp functions from json.error to json.message. [1][2]
This pull request includes changes primarily aimed at refactoring the way email domains are extracted and handled, and improving error messaging in the authentication process. The
extract-domain
package was removed and replaced with a customgetEmailDomain
function, which is now used in multiple files. Additionally, the error messaging in thesignIn
andsignUp
functions was changed fromjson.error
tojson.message
.Refactoring email domain extraction:
package.json
: Removed theextract-domain
package.src/shared/helpers/get-email-domain.js
: Added a new functiongetEmailDomain
for extracting the domain from an email address.src/server/controllers/admin/settings.js
andsrc/server/prehandlers/restrict-organization-email.js
: Replaced usage ofextractDomain
withgetEmailDomain
. [1] [2]src/server/controllers/admin/settings.js
: Updated therestrict_organization_email
field to usegetEmailDomain
.src/server/prehandlers/restrict-organization-email.js
: Updated the domain comparison logic to usegetEmailDomain
.Improving error messaging:
src/client/api/authentication.js
: Changed the error field in the response object of thesignIn
andsignUp
functions fromjson.error
tojson.message
. [1] [2]