Logout link added

Logout link added to left of version no, next to logo in top right
Clicking this triggers the logout function, which directs the browser to
the same window location with ?logout QS
The settings.php file is run again (via inclusion) and finding the QS
var, sets the loggedIn var set to false (as a double measure to the
session also being destroyed) and header location boots user back to
login screen
This commit is contained in:
Matt Pass
2013-01-13 14:37:36 +00:00
parent 3f1801ef2b
commit deb3ad5359
4 changed files with 15 additions and 2 deletions

View File

@@ -98,7 +98,7 @@ if (file_exists(dirname(__FILE__)."/plugins/jshint/jshint.js")) {
<div class="plugins" id="pluginsContainer">
<?php echo $pluginsDisplay; ?>
</div>
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
<div class="version"><a href="javascript:top:ICEcoder.logout()">logout</a> : v <?php echo $ICEcoder["versionNo"];?></div><img src="images/full-screen.gif" id="screenMode" class="screenModeIcon" onClick="top.ICEcoder.fullScreenSwitcher()">
<img src="images/ice-coder.png" class="logo" onClick="ICEcoder.helpScreen()" onContextMenu="ICEcoder.settingsScreen()">
</div>

View File

@@ -70,6 +70,7 @@ h2 {font-size: 18px; font-weight: normal; color: #fff}
.header .plugins img {position: relative; display: inline-block; margin-right: 15px}
.header .screenModeIcon {position: absolute; top: 5px; right: 178px; cursor: pointer}
.header .version {position: relative; display: inline-block; margin-top: 25px; font-size: 10px; color: #bbb}
.header .version a {font-size: 10px; color: #bbb; text-decoration: none}
.header .logo {position: relative; margin: 5px 10px 0 5px; cursor: pointer}
.files {position: absolute; display: inline-block; top: 0; left: 0; height: 100%; width: 250px; background-color: #444; background-image: url('../images/files-arrow.png'); background-repeat: no-repeat; background-position: 100% 50%; overflow: hidden; z-index: 1;

View File

@@ -1479,6 +1479,11 @@ var ICEcoder = {
top.ICEcoder.serverMessage('<b>chMod '+perms+' on </b><br>'+file.replace(top.iceRoot,""));
},
// Logout of ICEcoder
logout: function() {
window.location = window.location + "?logout";
},
// Show a message
message: function(msg) {
alert(msg);

View File

@@ -11,6 +11,13 @@ error_reporting(-1);
// Start a session if we haven't already
if(!isset($_SESSION)) {session_start();}
// Logout if that's the action we're taking
if (isset($_GET['logout'])) {
$_SESSION['loggedIn']=false;
session_destroy();
header("Location: dirname(__FILE__)./?loggedOut");
}
// Function to handle salted hashing
define('SALT_LENGTH',9);
function generateHash($plainText,$salt=null) {
@@ -262,7 +269,7 @@ echo $ICEcoder["accountPassword"] == "" ? "Setup" : "Login";
<div class="version">v <?php echo $ICEcoder["versionNo"];?></div>
<form name="settingsUpdate" action="settings.php" method="POST">
<input type="password" name="<?php echo $ICEcoder["accountPassword"] == "" ? "account" : "login"; ?>Password" class="accountPassword"><br><br>
<input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "Set Password" : "Login"; ?>" class="button">
<input type="submit" name="submit" value="<?php echo $ICEcoder["accountPassword"] == "" ? "set password" : "login"; ?>" class="button">
</form>
</div>
</div>