From: Jess Robinson Date: Fri, 6 Jul 2012 14:56:03 +0000 (+0000) Subject: display is now 'email', allowing ::Auth to email after register. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a528f0f656c88f72ce332949963b0648193b3b84;p=scpubgit%2Fstemmatology.git display is now 'email', allowing ::Auth to email after register. --- diff --git a/lib/Text/Tradition/Directory.pm b/lib/Text/Tradition/Directory.pm index ed5f9b2..e073503 100644 --- a/lib/Text/Tradition/Directory.pm +++ b/lib/Text/Tradition/Directory.pm @@ -378,7 +378,7 @@ sub add_user { my $user = Text::Tradition::User->new( id => $username, password => ($password ? crypt_password($password) : ''), - display => ($userinfo->{display} ? $userinfo->{display} : $username), + email => ($userinfo->{email} ? $userinfo->{email} : $username), role => $role, ); @@ -413,7 +413,7 @@ sub extract_openid_data { ## Somewhat ugly attribute extension reponse, contains ## google-email string which we can use as the id - $userinfo->{display} = $userinfo->{extensions}{'http://openid.net/srv/ax/1.0'}{'value.email'}; + $userinfo->{email} = $userinfo->{extensions}{'http://openid.net/srv/ax/1.0'}{'value.email'}; } return; @@ -442,7 +442,7 @@ sub find_user { my $user = $self->lookup(Text::Tradition::User->id_for_user($username)); return if(!$user || !$user->active); - print STDERR "Found user, $username, display is :", $user->display, ":\n"; + print STDERR "Found user, $username, email is :", $user->email, ":\n"; return $user; } diff --git a/lib/Text/Tradition/User.pm b/lib/Text/Tradition/User.pm index 18a91df..868c25b 100644 --- a/lib/Text/Tradition/User.pm +++ b/lib/Text/Tradition/User.pm @@ -6,9 +6,9 @@ use warnings; use Moose; with qw(KiokuX::User); -## 'id' provided by KiokuX::User stores our username +## 'id' provided by KiokuX::User stores our username (email for local users, openid url for openid/google) has 'password' => (is => 'rw', required => 1); -has 'display' => (is => 'rw', lazy => 1, builder => '_build_display'); +has 'email' => (is => 'rw', lazy => 1, builder => '_build_email'); ## Change this default active value if you want/need to have an admin confirm a user after they self-create. has 'active' => (is => 'rw', default => sub { 1; }); has 'role' => (is => 'rw', default => sub { 'user' }); @@ -29,10 +29,10 @@ after add_tradition => sub { unless $tradition->has_user && $tradition->user->id eq $self->id; }; -sub _build_display { +sub _build_email { my ($self) = @_; - ## no display set, so use username/id + ## no email set, so use username/id return $self->id; } diff --git a/stemmaweb/lib/stemmaweb.pm b/stemmaweb/lib/stemmaweb.pm index 7427973..1883f4b 100644 --- a/stemmaweb/lib/stemmaweb.pm +++ b/stemmaweb/lib/stemmaweb.pm @@ -100,7 +100,7 @@ __PACKAGE__->config( login_id_field => 'username', login_db_field => 'username', action_after_login => '/index', - send_register_email => 0, + action_after_register => '/index', realm => 'default', login_fields => { openid => [qw/openid_identifier/], default => [qw/username password remember/], diff --git a/stemmaweb/root/src/auth/register.tt b/stemmaweb/root/src/auth/register.tt index da497e6..ebd6771 100644 --- a/stemmaweb/root/src/auth/register.tt +++ b/stemmaweb/root/src/auth/register.tt @@ -17,7 +17,7 @@
- [% form.field('username').render %] + [% form.field('username').render %] (email) [% form.field('password').render %] [% form.field('confirm_password').render %] diff --git a/stemmaweb/root/src/index.tt b/stemmaweb/root/src/index.tt index 945f1e8..246336d 100644 --- a/stemmaweb/root/src/index.tt +++ b/stemmaweb/root/src/index.tt @@ -14,7 +14,7 @@ $(document).ready(function() {

Stemmaweb - a collection of tools for analysis of collated texts

- [% IF c.user_exists %]Hello! [% c.user.get_object.display %] [% ELSE %]Login | Register | [% END %]About | Help + [% IF c.user_exists %]Hello! [% c.user.get_object.email %] [% ELSE %]Login | Register | [% END %]About | Help

Text directory