From: Errietta Kostala Date: Fri, 23 Jan 2015 10:04:10 +0000 (+0000) Subject: Create g+ user if doesn't exist. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=40d56e641d7c1dc0722f8e521e711b3ab5a81650;p=scpubgit%2Fstemmaweb.git Create g+ user if doesn't exist. --- diff --git a/lib/Text/Tradition/Directory.pm b/lib/Text/Tradition/Directory.pm index 078127c..cb20c97 100644 --- a/lib/Text/Tradition/Directory.pm +++ b/lib/Text/Tradition/Directory.pm @@ -440,6 +440,10 @@ sub add_user { my $password = $userinfo->{password}; my $role = $userinfo->{role} || 'user'; + if ($userinfo->{sub}) { + $username = $userinfo->{sub}; + } + throw( "No username given" ) unless $username; throw( "Invalid password - must be at least " . $self->MIN_PASS_LEN . " characters long" ) @@ -559,7 +563,7 @@ sub _find_gplus { }); if (!$user) { - throw ("Could not find a user with that openid or sub!"); + return undef; } my $new_user = $self->add_user({