зеркало из https://github.com/mozilla/pjs.git
- adding interim logout functionality;
- reorder bug reference table rows
This commit is contained in:
Родитель
30611e0f39
Коммит
18f2c0dbb3
|
@ -47,18 +47,28 @@ our @EXPORT = qw();
|
|||
my $logincookiename = $Litmus::Config::user_cookiename;
|
||||
|
||||
sub setCookie {
|
||||
my $user = shift;
|
||||
my $user = shift;
|
||||
my $expires = shift;
|
||||
|
||||
my $user_id = 0;
|
||||
if ($user) {
|
||||
$user_id = $user->userid();
|
||||
}
|
||||
|
||||
if (!$expires or $expires eq '') {
|
||||
$expires = '+3d';
|
||||
}
|
||||
|
||||
my $c = new CGI;
|
||||
|
||||
my $cookie = $c->cookie(
|
||||
-name => $logincookiename,
|
||||
-value => $user->userid(),
|
||||
-domain => $main::ENV{"HTTP_HOST"},
|
||||
-expires=>'+3d',
|
||||
);
|
||||
|
||||
return $cookie;
|
||||
my $c = new CGI;
|
||||
|
||||
my $cookie = $c->cookie(
|
||||
-name => $logincookiename,
|
||||
-value => $user_id,
|
||||
-domain => $main::ENV{"HTTP_HOST"},
|
||||
-expires => $expires,
|
||||
);
|
||||
|
||||
return $cookie;
|
||||
}
|
||||
|
||||
sub getCookie() {
|
||||
|
@ -95,4 +105,19 @@ sub canEdit($) {
|
|||
return $userobj->istrusted();
|
||||
}
|
||||
|
||||
#########################################################################
|
||||
# logout()
|
||||
#
|
||||
# Unset the user's cookie, and return them to the main index.
|
||||
#########################################################################
|
||||
sub logout() {
|
||||
my $c = new CGI;
|
||||
|
||||
my $cookie = Litmus::Auth::setCookie(undef,'-1d');
|
||||
return $cookie;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*-
|
||||
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Litmus.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# the Mozilla Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2005
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Chris Cooper <ccooper@deadsquid.com>
|
||||
# Zach Lipton <zach@zachlipton.com>
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
use strict;
|
||||
$|++;
|
||||
|
||||
use Litmus;
|
||||
use Litmus::Auth;
|
||||
|
||||
use CGI;
|
||||
use diagnostics;
|
||||
|
||||
my $title = "Log out";
|
||||
|
||||
my $c = new CGI;
|
||||
my $cookie = Litmus::Auth::logout();
|
||||
|
||||
print $c->header(-cookie => $cookie);
|
||||
|
||||
my $vars = {
|
||||
title => $title,
|
||||
};
|
||||
|
||||
Litmus->template()->process("logout.tmpl", $vars) ||
|
||||
internalError(Litmus->template()->error());
|
||||
|
||||
|
||||
|
||||
exit;
|
|
@ -5,6 +5,10 @@
|
|||
<meta name="KEYWORDS" content="Main Page" />
|
||||
<meta name="robots" content="index,follow" />
|
||||
|
||||
[% IF redirect_home %]
|
||||
<meta http-equiv="refresh" content="5;URL=/litmus_staging/coop">
|
||||
[% END %]
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" media="all" href="css/litmus.css" />
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
[% INCLUDE global/html_header.tmpl redirect_home=1 %]
|
||||
[% INCLUDE global/litmus_header.tmpl %]
|
||||
|
||||
<div id="page">
|
||||
|
||||
[% INCLUDE sidebar/sidebar.tmpl %]
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1 class="firstHeading">[% title %]</h1>
|
||||
You have been successfully logged out of Litmus.
|
||||
|
||||
</div> <!--END content-->
|
||||
|
||||
</div> <!--END page-->
|
||||
|
||||
[% INCLUDE global/litmus_footer.tmpl %]
|
||||
[% INCLUDE global/html_footer.tmpl %]
|
|
@ -69,6 +69,17 @@ Referenced Bugs
|
|||
|
||||
<table class="single-result">
|
||||
<tr class="odd">
|
||||
[% IF defaultemail %]
|
||||
<td>
|
||||
Add bug references: <input name="new_bugs" type="text" value=""> (bug #,bug #,...) <input type="submit" value="Add Bug References">
|
||||
</td>
|
||||
[% ELSE %]
|
||||
<td colspan="2" class="no-results">
|
||||
You must log in before you can add bug references.
|
||||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
<tr class="even">
|
||||
<td>
|
||||
[% IF result.bugs %]
|
||||
Bug IDs:
|
||||
|
@ -80,18 +91,6 @@ No bugs on file.
|
|||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% IF defaultemail %]
|
||||
<tr class="even">
|
||||
<td>
|
||||
Add bug references: <input name="new_bugs" type="text" value=""> (bug #,bug #,...) <input type="submit" value="Add Bug References">
|
||||
</td>
|
||||
</tr>
|
||||
[% ELSE %]
|
||||
<td colspan="2" class="no-results">
|
||||
You must log in before you can add bug references.
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
|
||||
</div> <!--END section-content-->
|
||||
|
@ -141,7 +140,7 @@ Anonymous
|
|||
</tr>
|
||||
[% ELSE %]
|
||||
<tr class="even">
|
||||
<td class="no-results" colspan="2">
|
||||
<td colspan="2">
|
||||
No comments.
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[% IF defaultemail %]
|
||||
<h3>Welcome!</h3>
|
||||
<span class="email"><abbr title="[% defaultemail.email %]">[% defaultemail.email.replace('\@.*','') %]</abbr></span>
|
||||
<p align="right"><a href="#" onclick="alert('Not Linked'); return false;">Log out</a></p>
|
||||
<p align="right"><a href="logout.cgi">Log out</a></p>
|
||||
[% ELSE %]
|
||||
<h3>Log in</h3>
|
||||
<p>Username:<br/><input type="text" name="username" value="" size="10"></p>
|
||||
|
|
Загрузка…
Ссылка в новой задаче