r51151 - in /trunk/libjifty-plugin-openid-perl: ./ debian/ lib/Jifty/Plugin/ lib/Jifty/Plugin/OpenID/ lib/Jifty/Plugin/OpenID/Action/ share/ t/TestApp/ t/TestApp/lib/TestApp/ t/TestApp/t/ t/TestApp/var/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Jan 17 19:12:01 UTC 2010
Author: jawnsy-guest
Date: Sun Jan 17 19:11:54 2010
New Revision: 51151
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51151
Log:
* New upstream release
* Rewrite control description
* Standards-Version 3.8.3 (no changes)
* Update dependency on Net::OpenID::Consumer
* Add myself to Uploaders and Copyright
Added:
trunk/libjifty-plugin-openid-perl/share/
- copied from r51150, branches/upstream/libjifty-plugin-openid-perl/current/share/
trunk/libjifty-plugin-openid-perl/t/TestApp/t/01-ax-test.t
- copied unchanged from r51150, branches/upstream/libjifty-plugin-openid-perl/current/t/TestApp/t/01-ax-test.t
trunk/libjifty-plugin-openid-perl/t/TestApp/testapp
- copied unchanged from r51150, branches/upstream/libjifty-plugin-openid-perl/current/t/TestApp/testapp
trunk/libjifty-plugin-openid-perl/t/TestApp/var/
- copied from r51150, branches/upstream/libjifty-plugin-openid-perl/current/t/TestApp/var/
Modified:
trunk/libjifty-plugin-openid-perl/Changes
trunk/libjifty-plugin-openid-perl/MANIFEST
trunk/libjifty-plugin-openid-perl/META.yml
trunk/libjifty-plugin-openid-perl/Makefile.PL
trunk/libjifty-plugin-openid-perl/README
trunk/libjifty-plugin-openid-perl/debian/changelog
trunk/libjifty-plugin-openid-perl/debian/control
trunk/libjifty-plugin-openid-perl/debian/copyright
trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID.pm
trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm
trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Dispatcher.pm
trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/View.pm
trunk/libjifty-plugin-openid-perl/t/TestApp/lib/TestApp/View.pm
Modified: trunk/libjifty-plugin-openid-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/Changes?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/Changes (original)
+++ trunk/libjifty-plugin-openid-perl/Changes Sun Jan 17 19:11:54 2010
@@ -1,4 +1,8 @@
Revision history for Perl module Jifty::Plugin::OpenID
+
+1.01 Mon, 11 Jan 2010 10:59:19 +0100
+ - add Attribute Exchange management
+ - bump Net::OpenID::Consumer dep
1.00 Wed, 10 Jun 2009 11:55:15 +0200
- bump version number to avoid conflict with debian
Modified: trunk/libjifty-plugin-openid-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/MANIFEST?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/MANIFEST (original)
+++ trunk/libjifty-plugin-openid-perl/MANIFEST Sun Jan 17 19:11:54 2010
@@ -22,6 +22,13 @@
MANIFEST This list of files
META.yml
README
+share/po/fr.po
+share/po/openid.pot
+share/web/static/css/openidplugin.css
+share/web/static/oidimg/FriendConnect.gif
+share/web/static/oidimg/myopenid.png
+share/web/static/oidimg/openid-icon-small.gif
+share/web/static/oidimg/yfavicon.gif
t/00-load.t
t/TestApp/bin/jifty
t/TestApp/etc/config.yml
@@ -29,3 +36,7 @@
t/TestApp/lib/TestApp/View.pm
t/TestApp/t/00-model-User.t
t/TestApp/t/00-openid-test.t
+t/TestApp/t/01-ax-test.t
+t/TestApp/testapp
+t/TestApp/var/jifty-server-parent.pid
+t/TestApp/var/jifty-server.pid
Modified: trunk/libjifty-plugin-openid-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/META.yml?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/META.yml (original)
+++ trunk/libjifty-plugin-openid-perl/META.yml Sun Jan 17 19:11:54 2010
@@ -1,7 +1,7 @@
---
abstract: 'Provides OpenID authentication for your jifty app'
author:
- - 'Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >'
+ - 'Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >, Yves Agostini'
distribution_type: module
generated_by: 'Module::Install version 0.76'
license: perl
@@ -11,13 +11,14 @@
name: Jifty-Plugin-OpenID
no_index:
directory:
+ - share
- inc
- t
requires:
Cache::FileCache: 0
Jifty: 0
LWPx::ParanoidAgent: 0
- Net::OpenID::Consumer: 0
+ Net::OpenID::Consumer: 1.03
resources:
license: http://dev.perl.org/licenses/
-version: 1.00
+version: 1.01
Modified: trunk/libjifty-plugin-openid-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/Makefile.PL?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/Makefile.PL (original)
+++ trunk/libjifty-plugin-openid-perl/Makefile.PL Sun Jan 17 19:11:54 2010
@@ -3,7 +3,7 @@
all_from('lib/Jifty/Plugin/OpenID.pm');
requires('Jifty');
-requires('Net::OpenID::Consumer');
+requires('Net::OpenID::Consumer' => '1.03' );
requires('Cache::FileCache');
# suspend this test on 1.00 will be back in 1.01
#requires('Test::OpenID::Server' );
Modified: trunk/libjifty-plugin-openid-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/README?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/README (original)
+++ trunk/libjifty-plugin-openid-perl/README Sun Jan 17 19:11:54 2010
@@ -83,11 +83,43 @@
h1 { "Done" };
};
+ Attribute Exchange
+ You can retrieve informations from remote profile on authentication
+ server with OpenID Attribute Exchange service extension.
+
+ Set in your config.yml
+
+ - OpenID:
+ ax_param: openid.ns.ax=http://openid.net/srv/ax/1.0&openid.ax.mode=fetch_request&openid.ax.type.email=http://axschema.org/contact/email&openid.ax.type.firstname=http://axschema.org/namePerson/first&openid.ax.type.lastname=http://axschema.org/namePerson/last&openid.ax.required=firstname,lastname,email
+ ax_values: value.email,value.firstname,value.lastname
+ ax_mapping: "{ 'email': 'value.email', 'name': 'value.firstname value.lastname' }"
+
+ this parameters are usuable for all OpenID endpoints supporting
+ Attribute Exchange extension. They can be overriden in your application.
+ Watch and/or override "openid/wayf" template from
+ Jifty::Plugin::OpenID::View.
+
+ Or you can use in your view "show('openid/wayf','/url_return_to');".
+
+ ax_param
+ is the url send to authentication server. It defines namespace, mode,
+ attributes types and requested attributes.
+
+ hints : MyOpenID use schema.openid.net schemas instead of axschema.org,
+ Google provides lastname and firstname, Yahoo only fullname
+
+ ax_values
+ keys of attributes values read from authentication server response.
+
+ ax_mapping
+ mapping of recieve values with our applicalication fields in json
+ format.
+
AUTHORS
- Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >
+ Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >, Yves Agostini
LICENSE
- Copyright 2005-2009 Best Practical Solutions, LLC.
+ Copyright 2005-2010 Best Practical Solutions, LLC.
This program is free software and may be modified and distributed under
the same terms as Perl itself.
Modified: trunk/libjifty-plugin-openid-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/debian/changelog?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/debian/changelog (original)
+++ trunk/libjifty-plugin-openid-perl/debian/changelog Sun Jan 17 19:11:54 2010
@@ -1,10 +1,18 @@
-libjifty-plugin-openid-perl (1.00-2) UNRELEASED; urgency=low
+libjifty-plugin-openid-perl (1.01-1) UNRELEASED; urgency=low
+ [ Jonathan Yu ]
+ * New upstream release
+ * Rewrite control description
+ * Standards-Version 3.8.3 (no changes)
+ * Update dependency on Net::OpenID::Consumer
+ * Add myself to Uploaders and Copyright
+
+ [ Salvatore Bonaccorso ]
* debian/control: Changed: Replace versioned (build-)dependency on
perl (>= 5.6.0-{12,16}) with an unversioned dependency on perl (as
permitted by Debian Policy 3.8.3).
- -- Salvatore Bonaccorso <salvatore.bonaccorso at gmail.com> Sun, 16 Aug 2009 20:14:37 +0200
+ -- Jonathan Yu <jawnsy at cpan.org> Sun, 17 Jan 2010 14:18:00 -0500
libjifty-plugin-openid-perl (1.00-1) unstable; urgency=low
Modified: trunk/libjifty-plugin-openid-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/debian/control?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/debian/control (original)
+++ trunk/libjifty-plugin-openid-perl/debian/control Sun Jan 17 19:11:54 2010
@@ -2,23 +2,21 @@
Section: perl
Priority: optional
Build-Depends: debhelper (>= 7)
-Build-Depends-Indep: perl, libjifty-perl,
- libnet-openid-consumer-perl, liblwpx-paranoidagent-perl,
- libcache-cache-perl
+Build-Depends-Indep: perl, libjifty-perl, liblwpx-paranoidagent-perl,
+ libnet-openid-consumer-perl (>= 1.03), libcache-cache-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: AGOSTINI Yves <agostini at univ-metz.fr>
-Standards-Version: 3.8.2
+Uploaders: AGOSTINI Yves <agostini at univ-metz.fr>,
+ Jonathan Yu <jawnsy at cpan.org>
+Standards-Version: 3.8.3
Homepage: http://search.cpan.org/dist/Jifty-Plugin-OpenID/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libjifty-plugin-openid-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/
Package: libjifty-plugin-openid-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libjifty-perl,
- libnet-openid-consumer-perl, liblwpx-paranoidagent-perl,
- libcache-cache-perl
+Depends: ${perl:Depends}, ${misc:Depends}, libjifty-perl, libcache-cache-perl,
+ libnet-openid-consumer-perl (>= 1.03), liblwpx-paranoidagent-perl
Description: OpenID authentication plugin for Jifty applications
- Jifty::Plugin::OpenID provides OpenID authentication for
- your Jifty application. This authentication is added to your User model. You
- can mix this authentication with other Jifty authentication plugins like
- email/password or ldap.
+ Jifty::Plugin::OpenID is a Jifty plugin that provides OpenID authentication.
+ It adds the authentication to your User model. You can also combine this with
+ other Jifty authentication plugins such as email/password or LDAP.
Modified: trunk/libjifty-plugin-openid-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/debian/copyright?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/debian/copyright (original)
+++ trunk/libjifty-plugin-openid-perl/debian/copyright Sun Jan 17 19:11:54 2010
@@ -1,34 +1,36 @@
-Format-Specification:
- http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
-Upstream-Maintainer: Alex Vandiver <alexmv at bestpractical.com>
-Upstream-Source: http://search.cpan.org/dist/Jifty-Plugin-OpenID/
-Upstream-Name: Jifty-Plugin-OpenID
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=59
+Maintainer: Alex Vandiver <alexmv at bestpractical.com>
+Source: http://search.cpan.org/dist/Jifty-Plugin-OpenID/
+Name: Jifty-Plugin-OpenID
Files: *
-Copyright: 2005-2009, Best Practical Solutions, LLC.
-License-Alias: Perl
-License: Artistic | GPL-1+
+Copyright: 2005-2010, Best Practical Solutions, LLC.
+License: Artistic or GPL-1+
-Files: inc/*
-Copyright: Copyright 2002 - 2008 by Brian Ingerson, Audrey Tang and Adam Kennedy.
-License: GPL-1+ | Artistic
- This program is free software; you can redistribute it and/or modify it under
- the same terms as Perl itself.
+Files: inc/Module/*
+Copyright: 2002-2009, Adam Kennedy <adamk at cpan.org>
+ 2002-2009, Audrey Tang <autrijus at autrijus.org>
+ 2002-2009, Brian Ingerson <ingy at cpan.org>
+License: Artistic or GPL-1+
Files: debian/*
-Copyright: 2009, AGOSTINI Yves <agostini at univ-metz.fr>
-License: Artistic | GPL-1+
+Copyright: 2010, Jonathan Yu <jawnsy at cpan.org>
+ 2009, AGOSTINI Yves <agostini at univ-metz.fr>
+License: Artistic or GPL-1+
License: Artistic
- This program is free software; you can redistribute it and/or modify
- it under the terms of the Artistic License, which comes with Perl.
- On Debian GNU/Linux systems, the complete text of the Artistic License
- can be found in `/usr/share/common-licenses/Artistic'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the Artistic License, which comes with Perl.
+ .
+ On Debian GNU/Linux systems, the complete text of the Artistic License
+ can be found in `/usr/share/common-licenses/Artistic'
License: GPL-1+
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
- On Debian GNU/Linux systems, the complete text of the GNU General
- Public License can be found in `/usr/share/common-licenses/GPL'
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+ .
+ On Debian GNU/Linux systems, the complete text of the GNU General
+ Public License can be found in `/usr/share/common-licenses/GPL'
+
Modified: trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID.pm?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID.pm (original)
+++ trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID.pm Sun Jan 17 19:11:54 2010
@@ -4,7 +4,7 @@
package Jifty::Plugin::OpenID;
use base qw/Jifty::Plugin/;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
=head1 NAME
@@ -95,13 +95,55 @@
h1 { "Done" };
};
+=head2 Attribute Exchange
+
+You can retrieve informations from remote profile on authentication server with
+ OpenID Attribute Exchange service extension.
+
+Set in your config.yml
+
+ - OpenID:
+ ax_param: openid.ns.ax=http://openid.net/srv/ax/1.0&openid.ax.mode=fetch_request&openid.ax.type.email=http://axschema.org/contact/email&openid.ax.type.firstname=http://axschema.org/namePerson/first&openid.ax.type.lastname=http://axschema.org/namePerson/last&openid.ax.required=firstname,lastname,email
+ ax_values: value.email,value.firstname,value.lastname
+ ax_mapping: "{ 'email': 'value.email', 'name': 'value.firstname value.lastname' }"
+
+this parameters are usuable for all OpenID endpoints supporting Attribute
+Exchange extension. They can be overriden in your application. Watch and/or
+override C<openid/wayf> template from L<Jifty::Plugin::OpenID::View>.
+
+Or you can use in your view C<show('openid/wayf','/url_return_to');>.
+
+
+=head3 ax_param
+
+is the url send to authentication server. It defines namespace, mode, attributes
+types and requested attributes.
+
+hints : MyOpenID use schema.openid.net schemas instead of axschema.org, Google
+provides lastname and firstname, Yahoo only fullname
+
+=head3 ax_values
+
+keys of attributes values read from authentication server response.
+
+=head3 ax_mapping
+
+mapping of recieve values with our applicalication fields in json format.
+
=cut
+
+__PACKAGE__->mk_accessors(qw(ax_mapping ax_values ax_param));
sub init {
my $self = shift;
my %opt = @_;
my $ua_class = $self->get_ua_class;
eval "require $ua_class";
+ $self->ax_param($opt{ax_param});
+ $self->ax_mapping($opt{ax_mapping});
+ $self->ax_values($opt{ax_values});
+
+ Jifty->web->add_css('openidplugin.css');
}
sub get_ua_class {
@@ -142,11 +184,11 @@
=head1 AUTHORS
-Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >
+Alex Vandiver, Cornelius <cornelius.howl {at} gmail.com >, Yves Agostini
=head1 LICENSE
-Copyright 2005-2009 Best Practical Solutions, LLC.
+Copyright 2005-2010 Best Practical Solutions, LLC.
This program is free software and may be modified and distributed under the same terms as Perl itself.
Modified: trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm (original)
+++ trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Action/AuthenticateOpenID.pm Sun Jan 17 19:11:54 2010
@@ -26,7 +26,16 @@
param 'openid' =>
label is _('OpenID URL'),
is mandatory,
- hints is 'For example: you.livejournal.com';
+ hints is _('For example: you.livejournal.com');
+
+ param 'ax_param' =>
+ render as 'Hidden';
+
+ param 'ax_values' =>
+ render as 'Hidden';
+
+ param 'ax_mapping' =>
+ render as 'Hidden';
param 'return_to' =>
render as 'Hidden',
@@ -39,10 +48,16 @@
=cut
+use Jifty::JSON qw /jsonToObj/;
+
sub take_action {
my $self = shift;
my $openid = $self->argument_value('openid');
my $path = $self->argument_value('return_to');
+ my $plugin = Jifty->find_plugin('Jifty::Plugin::OpenID');
+ my $ax_mapping = $self->argument_value('ax_mapping') || $plugin->ax_mapping();
+ my $ax_param = $self->argument_value('ax_param') || $plugin->ax_param();
+ my $ax_values = $self->argument_value('ax_values') || $plugin->ax_values();
my $baseurl = Jifty->web->url;
my $csr = Jifty::Plugin::OpenID->get_csr( required_root => $baseurl );
@@ -50,7 +65,7 @@
my $claimed_id = $csr->claimed_identity( $openid );
if ( not defined $claimed_id ) {
- $self->result->error(_("Invalid OpenID URL. Please check to make sure it is correct. (@{[$csr->err]})"));
+ $self->result->error(_("Invalid OpenID URL. Please check to make sure it is correct. (%1)",@{[$csr->err]}));
return;
}
@@ -67,8 +82,11 @@
trust_root => $baseurl,
delayed_return => 1
);
+ Jifty->web->session->set(ax_mapping => jsonToObj($ax_mapping));
+ Jifty->web->session->set(ax_values => $ax_values);
+ $ax_param = '&'.$ax_param if $ax_param !~ m/^&/;
- Jifty->web->_redirect( $check_url . '&openid.sreg.optional=nickname' );
+ Jifty->web->_redirect( $check_url . '&openid.sreg.optional=nickname'.$ax_param );
return 1; # should never get here
}
Modified: trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Dispatcher.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Dispatcher.pm?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Dispatcher.pm (original)
+++ trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/Dispatcher.pm Sun Jan 17 19:11:54 2010
@@ -47,7 +47,7 @@
}
else {
$user->user_object->link_to_openid( $openid );
- $result->message(_("The OpenID '$openid' has been linked to your account."));
+ $result->message(_("The OpenID '%1' has been linked to your account.",$openid));
}
}
redirect '/';
@@ -80,11 +80,33 @@
# User needs to create account still
Jifty->web->session->set( openid => $openid );
Jifty->log->info("got openid: $openid");
+ my $Mapping = Jifty->web->session->get('ax_mapping');
+ if ($Mapping) {
+ # get ns, google set is own ns, usually ext1
+ # this need to be provided by csr
+ my $signed = get('openid.signed');
+ my $ns = $1 if $signed =~ m/ns\.(\w+?),/;
+ # get values
+ my $AX=();
+ foreach my $param ( split ',', Jifty->web->session->get('ax_values') ) {
+ $AX->{$param} = get('openid.'.$ns.'.'.$param);
+ };
+ # map values
+ foreach my $param (keys %$Mapping ) {
+ my $val = $Mapping->{$param};
+ $val =~ s/(value\.\w+(\.\d)?)/$AX->{$1}/g;
+ $Mapping->{$param} = $val;
+ };
+ $Mapping->{openid} = $openid;
+ };
my $nick = get('openid.sreg.nickname');
if ( $nick ) {
redirect( Jifty::Web::Form::Clickable->new( url => '/openid/create', parameters => {
nickname => $nick,
openid => $openid } ));
+ }
+ elsif ($Mapping) {
+ redirect( Jifty::Web::Form::Clickable->new( url => '/openid/create', parameters => $Mapping ) );
}
else {
redirect( Jifty::Web::Form::Clickable->new( url => '/openid/create' ) );
Modified: trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/View.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/View.pm?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/View.pm (original)
+++ trunk/libjifty-plugin-openid-perl/lib/Jifty/Plugin/OpenID/View.pm Sun Jan 17 19:11:54 2010
@@ -45,7 +45,7 @@
};
template 'openid/create' => page {
- title is 'Set your username';
+ title is _('Set your username');
my ( $action, $next ) = get( 'action', 'next' );
p {
@@ -61,10 +61,80 @@
);
};
Jifty->web->form->start( call => $next , name => 'openid-user-create' );
- render_action($action);
+ my $openidSP = Jifty->web->session->get('ax_mapping');
+ if ($openidSP) {
+ foreach my $param (keys %$openidSP) {
+ # keep get to use validation
+ render_param($action, $param, default_value => get($param) );
+ div { class is "form_field";
+ span { class is "hints";
+ outs( _( 'A link to confirm this email will be sent to receive later notifications.' ) );
+ }
+ } if ($param eq 'email');
+ }
+ }
+ else {
+ render_action($action);
+ };
form_submit( label => _('Continue'), submit => $action );
Jifty->web->form->end;
};
+# optionnal fragment to add direct links to Google, Yahoo,
+# MyOpenID login
+
+template 'openid/wayf' => sub {
+ my ( $self, $return_to ) = @_;
+ div { attr { class => ''; };
+ form {
+ my $google = new_action( class => 'AuthenticateOpenID', moniker => 'authenticateopenid' );
+ render_param($google, 'openid', render_as => 'hidden', default_value => 'www.google.com/accounts/o8/id');
+ render_param($google, 'ax_param', render_as => 'hidden', default_value => "openid.ns.ax=http://openid.net/srv/ax/1.0&openid.ax.mode=fetch_request&openid.ax.type.email=http://axschema.org/contact/email&openid.ax.type.firstname=http://axschema.org/namePerson/first&openid.ax.type.lastname=http://axschema.org/namePerson/last&openid.ax.required=firstname,lastname,email");
+ render_param($google, 'ax_mapping', render_as => 'hidden', default_value => "{ 'email': 'value.email', 'name': 'value.firstname value.lastname' }");
+ render_param($google, 'ax_values', render_as => 'hidden', default_value => "value.email,value.firstname,value.lastname" );
+ render_param($google,'return_to', render_as => 'hidden', default_value => '/openid/verify_and_login');
+ img { src is '/static/oidimg/FriendConnect.gif'; };
+ outs_raw(
+ Jifty->web->return(
+ as_link => 1,
+ to => $return_to,
+ label => _("Sign in with your Google Account"),
+ submit => $google
+ ));
+ };
+ form {
+ my $yahoo = new_action( class => 'AuthenticateOpenID', moniker => 'authenticateopenid' );
+ render_param($yahoo, 'openid', render_as => 'hidden', default_value => 'me.yahoo.com');
+ render_param($yahoo, 'ax_param', render_as => 'hidden', default_value => "openid.ns.ax=http://openid.net/srv/ax/1.0&openid.ax.mode=fetch_request&openid.ax.type.email=http://axschema.org/contact/email&openid.ax.type.fullname=http://axschema.org/namePerson&openid.ax.required=fullname,email");
+ render_param($yahoo, 'ax_mapping', render_as => 'hidden', default_value => "{ 'email': 'value.email', 'name': 'value.fullname' }");
+ render_param($yahoo, 'ax_values', render_as => 'hidden', default_value => "value.email,value.fullname" );
+ render_param($yahoo,'return_to', render_as => 'hidden', default_value => '/openid/verify_and_login');
+ img { src is '/static/oidimg/yfavicon.gif'; };
+ outs_raw(
+ Jifty->web->return(
+ as_link => 1,
+ to => $return_to,
+ label => _("Sign in with your Yahoo account"),
+ submit => $yahoo
+ ));
+ };
+ form {
+ my $myoid = new_action( class => 'AuthenticateOpenID', moniker => 'authenticateopenid' );
+ render_param($myoid, 'openid', render_as => 'hidden', default_value => 'www.myopenid.com');
+ render_param($myoid, 'ax_param', render_as => 'hidden', default_value => "openid.ns.ax=http://openid.net/srv/ax/1.0&openid.ax.mode=fetch_request&openid.ax.type.email=http://schema.openid.net/contact/email&openid.ax.type.nickname=http://schema.openid.net/namePerson/friendly&openid.ax.required=nickname,email");
+ render_param($myoid, 'ax_mapping', render_as => 'hidden', default_value => "{ 'email': 'value.email.1', 'name': 'value.nickname.1' }");
+ render_param($myoid, 'ax_values', render_as => 'hidden', default_value => "value.email.1,value.nickname.1" );
+ render_param($myoid,'return_to', render_as => 'hidden', default_value => '/openid/verify_and_login');
+ img { src is '/static/oidimg/myopenid.png'; };
+ outs_raw(
+ Jifty->web->return(
+ as_link => 1,
+ to => $return_to,
+ label => _("Sign in with your MyOpenID Account"),
+ submit => $myoid
+ ));
+ };
+ };
+};
1;
Modified: trunk/libjifty-plugin-openid-perl/t/TestApp/lib/TestApp/View.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjifty-plugin-openid-perl/t/TestApp/lib/TestApp/View.pm?rev=51151&op=diff
==============================================================================
--- trunk/libjifty-plugin-openid-perl/t/TestApp/lib/TestApp/View.pm (original)
+++ trunk/libjifty-plugin-openid-perl/t/TestApp/lib/TestApp/View.pm Sun Jan 17 19:11:54 2010
@@ -22,6 +22,7 @@
};
};
};
+ show 'openid/wayf', '/';
};
More information about the Pkg-perl-cvs-commits
mailing list