Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a validation process to new org creation #7453

Merged
merged 14 commits into from
Nov 15, 2022
Merged

Conversation

alexgarel
Copy link
Member

What

As a new user subscribe, telling he is from a company, if it's the first for that company, we currently create a new org and attach the user to it.

As there is a lot of potential fake data, we would like a "validation" round.

fixes: #7350

@github-actions github-actions bot added Orgs 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers 🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org 👥 Users labels Oct 6, 2022
@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch 2 times, most recently from 35ac5fd to 475e52d Compare October 7, 2022 17:40
@github-actions github-actions bot added the 💥 Merge Conflicts 💥 Merge Conflicts label Oct 18, 2022
@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch from 475e52d to 700e573 Compare October 21, 2022 14:06
@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch from 700e573 to b1cb8b1 Compare October 21, 2022 14:09
@github-actions github-actions bot added Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. and removed 💥 Merge Conflicts 💥 Merge Conflicts labels Oct 21, 2022
@alexgarel alexgarel marked this pull request as ready for review October 22, 2022 09:56
@alexgarel alexgarel requested a review from a team as a code owner October 22, 2022 09:56
lib/ProductOpener/Orgs.pm Outdated Show resolved Hide resolved

$user_ref->{org} = $user_ref->{requested_org_id};
$user_ref->{org_id} = get_string_id_for_lang("no_language", $user_ref->{org});
A user requested to be part of a producer organization.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that the email sent ? It's a bit crude

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure which mail you are talking about.

To the user, the only mail sent are:

  • add_user_email_body (see common.po)
  • reset_password_email_body (see common.po)

All the other mail are sent to the team.

@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch from 992d3fc to 983de4f Compare October 23, 2022 21:39
@github-actions github-actions bot removed the config label Oct 23, 2022
@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch from c862a9c to 750c2e5 Compare October 24, 2022 16:40
sub construct_test_url ($target, $prefix = "world") {
my $link = $TEST_MAIN_DOMAIN;
# no cgi inside url ? add display.pl
if (index($target, "cgi") == -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it odd to use index to see if the url contains cgi (and in fact we should check that it starts with /cgi)

Suggested change
if (index($target, "cgi") == -1) {
if ($target =~ /^\/cgi\//) {

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just some minor questions / suggestions.

Thanks a lot for all the extra comments, documentation and cutting into smaller functions.

@alexgarel alexgarel force-pushed the feat-ag-producer-crm branch from 6919b4b to b716c36 Compare November 14, 2022 21:22
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alexgarel alexgarel merged commit 6cf2d77 into main Nov 15, 2022
@alexgarel alexgarel deleted the feat-ag-producer-crm branch November 15, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📨 Mail Orgs 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. 🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org 🧪 unit tests 👥 Users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a validation process to new org creation
3 participants