diff --git a/lib/Foswiki/Plugins/UiByRestPlugin.pm b/lib/Foswiki/Plugins/UiByRestPlugin.pm index 853333b..5a063da 100644 --- a/lib/Foswiki/Plugins/UiByRestPlugin.pm +++ b/lib/Foswiki/Plugins/UiByRestPlugin.pm @@ -83,10 +83,11 @@ sub initPlugin { Foswiki::Func::registerRESTHandler('web_move', \&_moveWeb); Foswiki::Func::registerRESTHandler('wm', \&_moveWeb); Foswiki::Func::registerRESTHandler('web_create', \&_createWeb); - Foswiki::Func::registerRESTHandler('wc', \&_createWeb); + Foswiki::Func::registerRESTHandler('wc', \&_createWeb); # request-a-UI-form ( template ) rest handlers Foswiki::Func::registerRESTHandler('trform', \&_renameTopicForm); + Foswiki::Func::registerRESTHandler('loginform', \&_loginForm); return 1; } @@ -106,11 +107,25 @@ Perform a login and return eventually a login form sub _login { my $session = shift; + use Foswiki::Plugins::UiByRestPlugin::Login; return Foswiki::Plugins::UiByRestPlugin::Login::do( $session ); } =begin TML +---++ _loginForm( $session ) +return the Login form + +=cut + +sub _loginForm { + my $session = shift; + use Foswiki::Plugins::UiByRestPlugin::Login; + return Foswiki::Plugins::UiByRestPlugin::Login::template( $session ); +} + +=begin TML + ---++ _renameTopicForm( $session ) Return the template which is defined for renaming a topic ( renametopic.YOURSKIN.tmpl ) =cut diff --git a/lib/Foswiki/Plugins/UiByRestPlugin/Login.pm b/lib/Foswiki/Plugins/UiByRestPlugin/Login.pm index 123a692..97ece80 100644 --- a/lib/Foswiki/Plugins/UiByRestPlugin/Login.pm +++ b/lib/Foswiki/Plugins/UiByRestPlugin/Login.pm @@ -69,13 +69,6 @@ sub template { my $theWeb = $session->{webName}; my $theSkin = $query->param("skin") || Foswiki::Func::getSkin(); # SMELL: should be sanatized - # we do this, to get the proper status code. - # Eventhough we return the template requested in any case - # we will e.g. set a 400 if the user is not allowed - # this can be used by the request to maybe better show a login screen - # or something else. - _checkPrecondition($session); - # as we dont care about the template the hardPrecondition returns # we load the one requested return _showTemplate( $theTopic, $theWeb, $theSkin, $templatename ); @@ -92,7 +85,7 @@ sub _checkPrecondition { my $thePassword = $query->param("password") || undef; # already logged in? - if ( Foswiki::Func::getWikiName() eq $Foswiki::cfg{DefaultUserWikiName} ) { + if ( Foswiki::Func::getWikiName() ne $Foswiki::cfg{DefaultUserWikiName} ) { $session->{response}->status( "400 Already logged in" ); return _showTemplate( $theTopic, $theWeb, $theSkin, $templatename ); } diff --git a/lib/Foswiki/Plugins/UiByRestPlugin/MANIFEST b/lib/Foswiki/Plugins/UiByRestPlugin/MANIFEST index ff4ff0a..59e8868 100755 --- a/lib/Foswiki/Plugins/UiByRestPlugin/MANIFEST +++ b/lib/Foswiki/Plugins/UiByRestPlugin/MANIFEST @@ -1,3 +1,4 @@ lib/Foswiki/Plugins/UiByRestPlugin.pm Perl module lib/Foswiki/Plugins/UiByRestPlugin/TopicRename.pm +lib/Foswiki/Plugins/UiByRestPlugin/Login.pm data/System/UiByRestPlugin.txt Plugin topic