From: Jess Robinson Date: Tue, 15 May 2012 16:27:41 +0000 (+0000) Subject: Support creating users with no passwords, for OpenID X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=63bedbf3528745093ccf3f774a55b4fce02d7e31;p=scpubgit%2Fstemmatology.git Support creating users with no passwords, for OpenID (probably could be cleaner) --- diff --git a/lib/Text/Tradition/UserStore.pm b/lib/Text/Tradition/UserStore.pm index 5493d82..783bdc8 100644 --- a/lib/Text/Tradition/UserStore.pm +++ b/lib/Text/Tradition/UserStore.pm @@ -79,14 +79,15 @@ Create a new user object, store in the KiokuDB backend, and return it. sub add_user { my ($self, $userinfo) = @_; - my $username = $userinfo->{username}; + my $username = $userinfo->{url} || $userinfo->{username}; my $password = $userinfo->{password}; - return unless $username && $self->validate_password($password); + return unless ($username =~ /^https?:/ + || ($username && $self->validate_password($password))) ; my $user = Text::Tradition::User->new( id => $username, - password => crypt_password($password), + password => ($password ? crypt_password($password) : ''), ); my $scope = $self->new_scope; @@ -95,6 +96,11 @@ sub add_user { return $user; } +sub create_user { + my $self = shift; + return $self->add_user(@_); +} + =head3 find_user Takes a hashref of C, optionally C.