# Copyright (C) 2008 Eric Hsu # 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 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc. # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA $ModulesDescription .= '

$Id: password-bfc.pl,v 0.1 2008/07/31 23:20:09 Eric Hsu Exp $

'; # ================ # = password-bfc = # ================ # # (0.1) # Makes the password entry a little nicer. # Cleans up language of the dialogues. # Makes the password action more like a login. # Adds a link back to the last viewed page. # Clean up the language. $Translate{"Click to edit this page"}="Edit This Page"; $Translate{"View other revisions"}="See Past Edits"; $Translate{"This page is read-only"}="Editing Not Allowed (Login First)"; $Translate{'You are currently an administrator on this site.'}="You are now an administrator."; $Translate{'You are currently an editor on this site.'}="You are now an editor."; $Translate{'You are a normal user on this site.'}="You are now a normal user (neither an editor or administrator)."; $Translate{'Your password does not match any of the administrator or editor passwords.'}="It is safe to leave this site in your browser."; $UserGotoBar .= 'Login/Logout'; # Make the password action feel more like a login. $InvisibleCookieParameters{username}=1; *OldDoPassword = *DoPassword; *DoPassword = *NewDoPassword; $Action{password} = \&NewDoPassword; sub NewDoPassword { print GetHeader('',T('Password')), $q->start_div({-class=>'content password'}); my $username = GetParam('username', ''); print GetFormStart(undef, undef, 'password'); print $q->p($q->label({-for=>'username'}, T('Username:')) . ' ' . $q->textfield(-name=>'username', -id=>'username', -default=>$username, -override=>1, -size=>20, -maxlength=>50)); if ($AdminPass or $EditPass) { print $q->p(GetHiddenValue('action', 'password'), T('Password:'), ' ', $q->password_field(-name=>'pwd', -size=>20, -maxlength=>50), $q->submit(-name=>'Save', -accesskey=>T('s'), -value=>T('Save'))); } else { print $q->p(T('This site does not use admin or editor passwords.')); } my $lastpage = GetParam('lastpage'); print $q->hidden(-name => 'lastpage', -default => $lastpage, ); print $q->endform; print $q->end_div(); if (UserIsAdmin()) { print $q->p(T('You are currently an administrator on this site.')); } elsif (UserIsEditor()) { print $q->p(T('You are currently an editor on this site.')); } else { print $q->p(T('You are a normal user on this site.')); if ($AdminPass or $EditPass) { print $q->p(T('Your password does not match any of the administrator or editor passwords.')); } } print $q->p(T('Your password is saved in a cookie, if you have cookies enabled. Cookies may get lost if you connect from another machine, from another account, or using another software.')); $lastpage = GetPageLink($lastpage); print $q->p(Ts("Return to %s.", $lastpage)) if ($lastpage); PrintFooter(); } *OldGetFooterLinks = *GetFooterLinks; *GetFooterLinks = *NewGetFooterLinks; sub NewGetFooterLinks { my ($id, $rev) = @_; my $footer = OldGetFooterLinks(@_); $footer =~ s/action=password/action=password;lastpage=$id/; $UserGotoBar .= ScriptLink("action=password;lastpage=$id", "Login/Logout"); return $footer; } *OldGetGotoBar = *GetGotoBar; *GetGotoBar = *NewGetGotoBar; sub NewGetGotoBar { my ($id) = @_; my $footer = OldGetGotoBar(@_); $footer =~ s/action=password/action=password;lastpage=$id/; return $footer; }