Skip to content

Commit

Permalink
Item964: Fixing manifest, fixing flipped logic in Login::do, added lo…
Browse files Browse the repository at this point in the history
…ginform resthandler.

git-svn-id: http://svn.foswiki.org/trunk/UiByRestPlugin@2414 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
EugenMayer authored and EugenMayer committed Feb 8, 2009
1 parent 971e5b3 commit eb6bf22
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
17 changes: 16 additions & 1 deletion lib/Foswiki/Plugins/UiByRestPlugin.pm
Expand Up @@ -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;
}

Expand All @@ -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
Expand Down
9 changes: 1 addition & 8 deletions lib/Foswiki/Plugins/UiByRestPlugin/Login.pm
Expand Up @@ -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 );
Expand All @@ -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 );
}
Expand Down
1 change: 1 addition & 0 deletions 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

0 comments on commit eb6bf22

Please sign in to comment.