Skip to content

Commit

Permalink
refactor: adding perltidy to files (#7051)
Browse files Browse the repository at this point in the history
Implementing perltidy to cgi/ingredients.pl , cgi/login.pl , cgi/manifest.pl
  • Loading branch information
dipietroR authored and LandonPattison committed Jul 25, 2022
1 parent 65659d7 commit 9dc8ff6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
3 changes: 0 additions & 3 deletions .perltidy_excludes
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ cgi/import_file_select_format.pl
cgi/import_file_upload.pl
cgi/import_photos_upload.pl
cgi/import_products_categories_from_public_database.pl
cgi/ingredients.pl
cgi/login.pl
cgi/manifest.pl
cgi/opensearch.pl
cgi/product_image_crop.pl
cgi/product_image_move.pl
Expand Down
10 changes: 5 additions & 5 deletions cgi/ingredients.pl
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@

if (not defined $ocr_engine) {
$ocr_engine = "tesseract";

# $ocr_engine = "google_cloud_vision";
}

$log->debug("start", { code => $code, id => $id }) if $log->is_debug();
$log->debug("start", {code => $code, id => $id}) if $log->is_debug();

if (not defined $code) {

Expand All @@ -75,12 +76,11 @@
}
}
}
my $data = encode_json($results_ref);

$log->debug("JSON data output", { data => $data }) if $log->is_debug();
my $data = encode_json($results_ref);

print header ( -charset=>'UTF-8', -access_control_allow_origin => '*' ) . $data;
$log->debug("JSON data output", {data => $data}) if $log->is_debug();

print header (-charset => 'UTF-8', -access_control_allow_origin => '*') . $data;

exit(0);

21 changes: 14 additions & 7 deletions cgi/login.pl
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
my $user_file = "$data_root/users/" . get_string_id_for_lang('no_language', $User_id) . '.sto';
my $user_ref = retrieve($user_file);
if (not (defined $user_ref)) {
if (not(defined $user_ref)) {
push @errors, 'undefined user';
$template_data_ref->{success} = 0;
}

my $hash_is_correct = check_password_hash(encode_utf8(decode utf8=>param('password')), $user_ref->{'encrypted_password'} );
my $hash_is_correct
= check_password_hash(encode_utf8(decode utf8 => param('password')), $user_ref->{'encrypted_password'});

# We don't have the right password
if (not $hash_is_correct) {
$log->info('bad password - input does not match stored hash', { encrypted_password => $user_ref->{'encrypted_password'} }) if $log->is_info();
$log->info(
'bad password - input does not match stored hash',
{encrypted_password => $user_ref->{'encrypted_password'}}
) if $log->is_info();
push @errors, lang('error_bad_login_password');
}

Expand All @@ -87,7 +92,9 @@
$html .= '<p>' . $tt->error() . '</p>';
}

display_page( {
title => lang('login_register_title'),
content_ref => \$html,
});
display_page(
{
title => lang('login_register_title'),
content_ref => \$html,
}
);

0 comments on commit 9dc8ff6

Please sign in to comment.