Diff -- /var/www/vhosts/3dshawn.com/affiliate.3dshawn.com/verify_email.cgi
Diff

/var/www/vhosts/3dshawn.com/affiliate.3dshawn.com/verify_email.cgi

added on local at 2026-07-01 13:48:15

Added
+63
lines
Removed
-0
lines
Context
0
unchanged
Blobs
from
to 6c2747a6fc8c
Restore this content →
Unified diff
Naive LCS-based line diff. Additions in emerald, deletions in rose. Both sides decompressed live from BLOB_STORE.
1#!/usr/bin/perl
2#======================================================================
3# WebSTLs - Email verification redemption.
4#
5# GET /verify_email.cgi?t=TOKEN
6#
7# Validates the token via MODS::AffSoft::EmailVerify->verify_token.
8# On success: shows a confirmation page with a link to /dashboard.cgi
9# (or /login.cgi if the user isn't already signed in).
10# On failure: shows an error page with a "Send another link" CTA.
11#======================================================================
12use strict;
13use warnings;
14
15use lib '/var/www/vhosts/3dshawn.com/affiliate.3dshawn.com';
16use CGI;
17use MODS::Template;
18use MODS::DBConnect;
19use MODS::Login;
20use MODS::AffSoft::Config;
21use MODS::AffSoft::Wrapper;
22use MODS::AffSoft::EmailVerify;
23
24my $q = CGI->new;
25my $form = $q->Vars;
26my $auth = MODS::Login->new;
27my $wrap = MODS::AffSoft::Wrapper->new;
28my $tfile = MODS::Template->new;
29my $db = MODS::DBConnect->new;
30my $cfg = MODS::AffSoft::Config->new;
31my $DB = $cfg->settings('database_name');
32
33$|=1;
34
35my $token = defined $form->{t} ? $form->{t} : '';
36$token =~ s/[^a-fA-F0-9]//g;
37$token = substr($token, 0, 64);
38
39my $dbh = $db->db_connect();
40my $res = MODS::AffSoft::EmailVerify->verify_token($db, $dbh, $DB, $token);
41$db->db_disconnect($dbh);
42
43my $ok = $res->{ok} ? 1 : 0;
44my $err_msg = $ok ? '' : ($res->{error} || 'unknown error');
45my $is_signed_in = $auth->login_verify() ? 1 : 0;
46
47print "Content-Type: text/html; charset=utf-8\nCache-Control: no-cache, no-store\n\n";
48
49my $tvars = {
50 ok => $ok,
51 not_ok => $ok ? 0 : 1,
52 error_msg => $err_msg,
53 is_signed_in => $is_signed_in,
54 not_signed_in => $is_signed_in ? 0 : 1,
55};
56
57my $body = join('', $tfile->template('webstls_verify_email.html', $tvars, undef));
58
59$wrap->render({
60 userinfo => undef,
61 title => 'Email verification',
62 body => $body,
63});
Keyboard: j next diff k previous diff g top G bottom r restore c compile-check ? help