error message return if image processing fails
[sgn.git] / cgi-bin / solpeople / account-confirm.pl
blob2173c309fb3956928aa153299b9077a0cc7c8bba
1 #!/usr/bin/perl -w
2 use strict;
3 use warnings;
5 use CXGN::DB::Connection;
6 use CXGN::Page;
7 use CXGN::People;
8 use CXGN::People::Login;
10 my $page = CXGN::Page->new( "solpeople User Confirmation", "Koni" );
11 my $dbh = CXGN::DB::Connection->new();
13 my ( $username, $confirm_code ) = $page->get_arguments( "username", "confirm" );
14 my $sp = CXGN::People::Login->get_login( $dbh, $username );
16 if ( !$sp ) {
17 confirm_failure($page, "Username \"$username\" was not found.");
20 if ( $sp->get_confirm_code() ne $confirm_code ) {
21 confirm_failure($page, "Confirmation code is not valid!\n");
23 if ( !$sp->get_confirm_code() ) {
24 confirm_failure($page, "No confirmation is required for user <b>$username</b>");
27 $sp->set_disabled(undef);
28 $sp->set_confirm_code(undef);
29 $sp->set_private_email( $sp->get_pending_email() );
31 $sp->store();
33 $page->header();
35 print <<EOF;
37 <p>Confirmation successful for username <b>$username</b>.</p>
39 <p><a href="login.pl">[Login Page]</a></p>
40 <br />
42 EOF
44 $page->footer();
46 sub confirm_failure {
47 my ($page, $reason) = @_;
49 $page->header();
51 print <<EOF;
53 <p>Sorry, we are unable to process this confirmation request. Please check that your complete confirmation URL has been pasted correctly into your browser.</p>
55 <p><b>Reason:</b> $reason</p>
57 <br />
59 EOF
61 $page->footer();
63 exit 0;