diff options
author | Michael Kröll <pepl@cpan.org> | 2008-12-01 22:55:30 +0100 |
---|---|---|
committer | Michael Kröll <pepl@cpan.org> | 2008-12-01 22:55:30 +0100 |
commit | cfdbde16b89b845ab1297cc25dbde08649d42758 (patch) | |
tree | 61bc937c90442b81a00895a85175b7ae9fa1360e | |
parent | Merge branch 'master' of git@git.useperl.at:PAUSE-OpenID (diff) | |
download | Simple-OpenID-cfdbde16b89b845ab1297cc25dbde08649d42758.tar.gz Simple-OpenID-cfdbde16b89b845ab1297cc25dbde08649d42758.tar.bz2 Simple-OpenID-cfdbde16b89b845ab1297cc25dbde08649d42758.zip |
Stub for error page; redirect to error page when openid.return_to parameter is not given
-rw-r--r-- | lib/PAUSE/OpenID/Controller/Root.pm | 15 | ||||
-rw-r--r-- | root/templates/error.xsl | 29 |
2 files changed, 42 insertions, 2 deletions
diff --git a/lib/PAUSE/OpenID/Controller/Root.pm b/lib/PAUSE/OpenID/Controller/Root.pm index 129f3a4..ca52356 100644 --- a/lib/PAUSE/OpenID/Controller/Root.pm +++ b/lib/PAUSE/OpenID/Controller/Root.pm @@ -29,6 +29,11 @@ PAUSE::OpenID::Controller::Root - Root Controller for PAUSE::OpenID sub index :Path :Args(0) { my ( $self, $c ) = @_; + if ( not $c->req->param('openid.return_url') ) { + #$c->flash->{xml} = '<document><error_message>Missing parameter</error_message></document>'; + $c->res->redirect($c->uri_for('/error')); + } + $c->stash->{xml} =<<XML; <document/> XML @@ -38,7 +43,13 @@ XML $c->stash->{$key} = $c->req->param($key); } - # Hello World + $c->forward('PAUSE::OpenID::View::XSLT'); +} + +sub error :Local { + my ( $self, $c ) = @_; + #$c->stash->{xml} = $c->flash->{xml}; + $c->stash->{xml} = '<document/>'; $c->forward('PAUSE::OpenID::View::XSLT'); } @@ -55,7 +66,7 @@ sub login :Local { my $username = $c->req->param('username'); my $password = $c->req->param('password'); - $c->log->debug('username "'.$username.'" login attemp'); + $c->log->debug('username "'.$username.'" login attempt'); $c->res->redirect($c->uri_for('/login_failed')); } diff --git a/root/templates/error.xsl b/root/templates/error.xsl new file mode 100644 index 0000000..3aa236e --- /dev/null +++ b/root/templates/error.xsl @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" + xmlns:xhtml="http://www.w3.org/1999/xhtml" + xmlns="http://www.w3.org/1999/xhtml"> + + <xsl:output encoding="UTF-8" method="xml" omit-xml-declaration="yes" media-type="text/html" + doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" + doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" indent="no"/> + + <xsl:template match="/document"> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Error</title> + <style type="text/css"> + @import "default.css"; + </style> + </head> + + <body> + <p>An error occured.</p> + <xsl:if test="error_message != ''"> + <p id="error_message"> + <xsl:value-of select="error_message"/> + </p> + </xsl:if> + </body> + </html> + </xsl:template> +</xsl:stylesheet> |