Skip to content

Commit

Permalink
Item14199: Merge branch 'master' into Item13897
Browse files Browse the repository at this point in the history
Resolve conflicts .. RegisterTests pass.
  • Loading branch information
gac410 committed Oct 12, 2016
2 parents 76007f0 + 9d009b1 commit 1625ca4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
9 changes: 6 additions & 3 deletions UnitTestContrib/test/unit/RegisterTests.pm
Expand Up @@ -2106,9 +2106,12 @@ sub verify_UnregisteredUser {
};

my $file = $this->regUI->_codeFile( $regSave->{VerificationCode} );
$this->assert( open( my $F, '>', $file ) );
print $F Data::Dumper->Dump( [ $regSave, undef ], [ 'data', 'form' ] );
$this->assert( close $F );
use Storable;
store( $regSave, $file );

#$this->assert( open( my $F, '>', $file ) );
#print $F Data::Dumper->Dump( [ $regSave, undef ], [ 'data', 'form' ] );
#$this->assert( close $F );

my $result2 = $this->regUI->_loadPendingRegistration("GitWit.0");
$this->assert_deep_equals( $result2, $regSave );
Expand Down
42 changes: 16 additions & 26 deletions core/lib/Foswiki/UI/Register.pm
Expand Up @@ -13,6 +13,7 @@ use v5.14;

use Assert;
use Try::Tiny;
use Storable;

use Foswiki ();
use Foswiki::Form ();
Expand Down Expand Up @@ -798,20 +799,7 @@ sub _requireConfirmation {
$app->heap->{DebugVerificationCode} = $data->{"${type}Code"};

my $file = $this->_codeFile( $data->{"${type}Code"} );
my $F;
open( $F, '>', $file )
or
Foswiki::Exception::Fatal->throw( text => 'Failed to open file: ' . $! );
print $F "# $type code\n";

# SMELL: wierd jiggery-pokery required, otherwise Data::Dumper screws
# up the form fields when it saves. Perl bug? Probably to do with
# chucking around arrays, instead of references to them.
my $form = $data->{form};
$data->{form} = undef;
print $F Data::Dumper->Dump( [ $data, $form ], [ 'data', 'form' ] );
$data->{form} = $form;
close($F);
store( $data, $file );

$app->logger->log(
{
Expand Down Expand Up @@ -2308,16 +2296,19 @@ sub _loadPendingRegistration {
);
}

$data = undef;
$form = undef;
do $file;
$data->{form} = $form if $form;
Foswiki::OopsException->throw(
app => $app,
template => 'register',
def => 'bad_ver_code',
params => [ $code, 'Bad activation code' ]
) if $!;
try {
$data = retrieve($file);
}
catch {
my $e = shift;
require Data::Dumper;
print STDERR Data::Dumper::Dumper( \$e );
throw Foswiki::OopsException(
'register',
def => 'internal_error',
params => [ $code, 'Retrieve of stored registration failed' ]
);
};

return $data;
}
Expand Down Expand Up @@ -2427,8 +2418,7 @@ sub _checkPendingRegistrations {
}
if ($check) {
local $data;
local $form;
eval 'do $regFile';
$data = retrieve($regFile);
next unless defined $data;
push @pending, $data->{WikiName} . '(pending)'
if ( $check eq $data->{Email} );
Expand Down
7 changes: 7 additions & 0 deletions core/templates/registermessages.tmpl
Expand Up @@ -87,6 +87,13 @@
%MAKETEXT{"Please contact [_1] if you have any questions." args="<a href='mailto:%WIKIWEBMASTER%'>%WIKIWEBMASTER%</a>"}%
%TMPL:END%
%{==============================================================================}%
%TMPL:DEF{"internal_error"}%
---+++ %MAKETEXT{"Activation Failed"}%
%MAKETEXT{"Activation for code [_1] failed with an internal error." args="'<code>%PARAM1%</code>'"}% %PARAM2%

%MAKETEXT{"This is an internal error. You can try to register again, or contact [_1] to report the error." args="<a href='mailto:%WIKIWEBMASTER%'>%WIKIWEBMASTER%</a>"}%
%TMPL:END%
%{==============================================================================}%
%TMPL:DEF{"registration_mail_failed"}%
---+++ %MAKETEXT{"Error registering new user"}%

Expand Down

0 comments on commit 1625ca4

Please sign in to comment.