Skip to content

Commit

Permalink
Session management is complete!
Browse files Browse the repository at this point in the history
  • Loading branch information
pieman72 committed Jul 18, 2014
1 parent 682a361 commit 83de694
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
14 changes: 7 additions & 7 deletions adhoc.js
Expand Up @@ -1585,7 +1585,7 @@ Event.observe(window, 'load', function(){
erMsg = erMsg.replace(erRxp, '');
adhoc.message(erStatus, erMsg);

// TODO: highlight results.nodeId, if present
// TODO: highlight results.nodeId, if present

// If the errors are fatal, return;
if(erStatus == 'Error') return;
Expand Down Expand Up @@ -1855,9 +1855,9 @@ Event.observe(window, 'load', function(){
case adhoc.nodeWhich.LITERAL_HASH:
case adhoc.nodeWhich.LITERAL_STRCT:
adhoc.deactivateAllTools();
// TODO: Prompt for literal value
adhoc.message('This type of literal is not yet implemented'); break;
adhoc.createNode(null, prnt, repl, type, which, childType);
// TODO: Prompt for literal value
adhoc.message('This type of literal is not yet implemented'); break;
adhoc.createNode(null, prnt, repl, type, which, childType);
break;

default:
Expand Down Expand Up @@ -2561,7 +2561,7 @@ adhoc.rootNode = adhoc.createNode(
n.height = 100;

// Darw the items
// TODO: draw shorthand for array items
// TODO: draw shorthand for array items

// Draw the brackets
ctx.strokeStyle = '#000000';
Expand Down Expand Up @@ -2604,11 +2604,11 @@ adhoc.rootNode = adhoc.createNode(
break;

case adhoc.nodeWhich.LITERAL_HASH:
// TODO: render a literal hash
// TODO: render a literal hash
break;

case adhoc.nodeWhich.LITERAL_STRCT:
// TODO: render a literal struct
// TODO: render a literal struct
break;

}
Expand Down
24 changes: 18 additions & 6 deletions index.php
Expand Up @@ -75,22 +75,34 @@
// Add password back to settings (if requested) and pass settings in the cookie
if(!count($errors)){
$_SESSION['username'] = $username;
if($settings->remember){
$settingsTemp = json_decode($settingsTemp);
$settingsTemp->password = sha1($_POST['password']);
$settingsTemp = json_encode($settingsTemp);
}
$settings = $settingsTemp;
setcookie(
'adhocSettings'
,$settingsTemp
,strtotime('+1 year')
,'/adhoc_demo/'
,''
);
if($settings->remember){
$settingsTemp = json_decode($settingsTemp);
$settingsTemp->password = $settings->password;
$settingsTemp = json_encode($settingsTemp);
}
$settings = json_decode($settingsTemp);
}
}

// If the user was not loaded, clear the settings
if(!$_SESSION['username']){
setcookie(
'adhocSettings'
,''
,strtotime('+1 year')
,'/adhoc_demo/'
,''
);
$settings = (object) array();
}

// If the user was found, try to load their projects
$projects = array();
if(!count($errors) && $_SESSION['username']){
Expand Down
1 change: 1 addition & 0 deletions login/index.php
Expand Up @@ -106,6 +106,7 @@
,''
);
header('Location: /adhoc_demo/');
exit;
}
}?><!DOCTYPE html>
<html>
Expand Down

0 comments on commit 83de694

Please sign in to comment.