Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix pending login mechanism. Still somethig todo with various session…
Browse files Browse the repository at this point in the history
…s opened.
  • Loading branch information
cdujeu committed Apr 28, 2014
1 parent 099c3e6 commit 36004df
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
21 changes: 18 additions & 3 deletions core/src/plugins/action.share/class.ShareCenter.php
Expand Up @@ -951,14 +951,15 @@ public static function loadMinisite($data, $hash = '')

session_name("AjaXplorer_Shared");
session_start();
AuthService::disconnect();

if (!empty($data["PRELOG_USER"])) {
AuthService::logUser($data["PRELOG_USER"], "", true);
$html = str_replace("AJXP_PRELOGED_USER", "ajxp_preloged_user", $html);
} else {
$_SESSION["PENDING_REPOSITORY_ID"] = $repository;
$_SESSION["PENDING_FOLDER"] = "/";
$html = str_replace("AJXP_PRELOGED_USER", "", $html);
$html = str_replace("AJXP_PRELOGED_USER", $data["PRESET_LOGIN"], $html);
}
if(isSet($hash)){
$_SESSION["CURRENT_MINISITE"] = $hash;
Expand Down Expand Up @@ -1279,7 +1280,11 @@ public function createSharedMinisite($httpVars, $repository, $accessDriver)
if (!empty($pref)) {
$userId = $pref.$userId;
}
$userPass = substr(md5(time()), 13, 24);
if(!empty($httpVars["guest_user_pass"])){
$userPass = $httpVars["guest_user_pass"];
}else{
$userPass = substr(md5(time()), 13, 24);
}
$httpVars["user_0"] = $userId;
$httpVars["user_pass_0"] = $httpVars["shared_pass"] = $userPass;
$httpVars["entry_type_0"] = "user";
Expand Down Expand Up @@ -1320,7 +1325,17 @@ public function createSharedMinisite($httpVars, $repository, $accessDriver)
$newId = $newRepo->getId();
$downloadFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
$this->initPublicFolder($downloadFolder);
$data = array("REPOSITORY"=>$newId, "PRELOG_USER"=>$userId);

$data = array(
"REPOSITORY"=>$newId
);
if(isSet($httpVars["create_guest_user"]) && isSet($userId)){
if(empty($httpVars["guest_user_pass"])){
$data["PRELOG_USER"] = $userId;
}else{
$data["PRESET_LOGIN"] = $userId;
}
}
if ($httpVars["disable_download"]) {
$data["DOWNLOAD_DISABLED"] = true;
}
Expand Down
4 changes: 3 additions & 1 deletion core/src/plugins/action.share/res/minisite.php
Expand Up @@ -123,7 +123,9 @@
"BOOTER_URL":"index_shared.php?get_action=get_boot_conf&goto=AJXP_START_REPOSITORY&minisite_session=true",
"EXT_REP":"\/",
"MAIN_ELEMENT":"AJXP_TEMPLATE_NAME",
"SERVER_PREFIX_URI": ""
"SERVER_PREFIX_URI": "",
"PRESET_LOGIN":"AJXP_PRELOGED_USER",
"PASSWORD_AUTH_ONLY":true
};
document.observe("ajaxplorer:before_gui_load", function(e){
ajaxplorer.currentThemeUsesIconFonts = true;
Expand Down
3 changes: 0 additions & 3 deletions core/src/plugins/core.auth/class.AbstractAuthDriver.php
Expand Up @@ -54,9 +54,6 @@ public function switchAction($action, $httpVars, $fileVars)
$loggingResult = -4;
} else {
$userId = (isSet($httpVars["userid"])?trim($httpVars["userid"]):null);
if($userId == 'PRESET_LOGIN' && isSet($_SESSION["PENDING_LOGIN"])){
$userId = $_SESSION["PENDING_LOGIN"];
}
$userPass = (isSet($httpVars["password"])?trim($httpVars["password"]):null);
$rememberMe = ((isSet($httpVars["remember_me"]) && $httpVars["remember_me"] == "true")?true:false);
$cookieLogin = (isSet($httpVars["cookie_login"])?true:false);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.auth/standard_auth_actions.xml
Expand Up @@ -88,7 +88,7 @@
var oForm = modal.getForm();
var connexion = new Connexion();
connexion.addParameter('get_action', 'login');
connexion.addParameter('userid', oForm.userid.value);
connexion.addParameter('userid', window.ajxpBootstrap.parameters.get('PRESET_LOGIN')?window.ajxpBootstrap.parameters.get('PRESET_LOGIN'):oForm.userid.value);
connexion.addParameter('login_seed', oForm.login_seed.value);
connexion.addParameter('remember_me', (oForm.remember_me && oForm.remember_me.checked?"true":"false"));
if(oForm.login_seed.value != '-1'){
Expand Down

0 comments on commit 36004df

Please sign in to comment.