Update of /cvsroot/phpslash/phpslash-dev/include/modules/auth/authtypes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv443/phpslash-dev/include/modules/auth/authtypes
Modified Files:
slashAuthCR.class
Added Files:
slashAuth.class
Log Message:
updated non CR loginform.tpl to be used with other auth methods
--- NEW FILE: slashAuth.class ---
<?php
/* $Id: slashAuth.class,v 1.1 2004/09/16 21:05:07 joestewart Exp $
*
*/
class slashAuth extends slashAuth_base {
}
?>
Index: slashAuthCR.class
===================================================================
RCS file: /cvsroot/phpslash/phpslash-dev/include/modules/auth/authtypes/slashAuthCR.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** slashAuthCR.class 15 Sep 2004 23:36:30 -0000 1.1
--- slashAuthCR.class 16 Sep 2004 21:05:07 -0000 1.2
***************
*** 14,71 ****
// psl built in Challenge Response
! function psl_validate($username, $password, $response, $user_info) {
! global $challenge;
! // debug("response", $response);
! // debug("challenge", $challenge);
! $is_user = false;
! // generate the expected response
! $md5_pw = $user_info['password']; // this is the raw MD5ed user/pass combo
!
! $expected_response = md5("$md5_pw:$challenge");
! // debug("expected_response", $expected_response);
! // True when JS is disabled
! if ($response == "") {
! $md5_pw_net = md5("$username:$password");
! $response = md5("$md5_pw_net:$challenge");
}
! // Response is set, JS might be enabled...
! // compare the responses
! if ($expected_response == $response) {
! // success
! $is_user = true;
} else {
! $this->auth["error"] = pslgetText("Either your username or password are invalid. Please try again.");
! }
! return $is_user;
! }
! // psl built in "Remember Me"
! function psl_preauth($username, $password, $user_info) {
! global $HTTP_COOKIE_VARS;
!
! $is_user = false;
!
! // decode the cookie data into an array
! $cookie_ary = unserialize(base64_decode($HTTP_COOKIE_VARS['user_info']));
!
! // generate the challenge we expect
! $cookie_challenge = md5($this->magic .":". $this->psl['basedir']);
!
! $md5_pw = $password; // this is the raw MD5ed user/pass combo
! $expected_response = md5("$md5_pw:$cookie_challenge");
!
! // compare the response given in the cookie to expected response
! if( $expected_response == $cookie_ary[0]) {
! $is_user = true;
}
! return $is_user;
! }
!
}
--- 14,91 ----
// psl built in Challenge Response
!
! /**
! * auth_loginform - displays the login form
! *
! * @todo: Move to Block_render_login
! *
! * @return void
! */
! function auth_loginform() {
! global $challenge, $sess, $saved_get, $saved_post;
!
! // preserve the POST variable through the login process
! $saved_post = $_POST;
! $saved_get = $_GET;
! $sess->register("saved_post");
! $sess->register("saved_get");
! // generate a challenge word if needed.
! if (empty($challenge)) {
! $challenge = md5(uniqid($this->magic));
! $sess->register("challenge");
! }
!
! // create the template object
! $templ = pslNew("slashTemplate");
! $templ->set_file(array(
! 'form' => 'loginformCR.tpl',
! 'index' => 'index1col.tpl'
! ));
!
! $templ->set_var( array(
! // 'ACTION_URL' => $this->psl['rooturl'] . "/login.php",
! 'ACTION_URL' => $this->psl['phpself'],
! 'PHP_SELF' => $this->psl['phpself'],
! 'ROOTURL' => $this->psl['rooturl'],
! 'CHALLENGE' => $challenge
! ));
!
! // Display the previously used name in the form field
! if (isset($this->auth["uname"]) && $this->auth["uname"] != "nobody") {
! $templ->set_var('USERNAME', htmlentities($this->auth["uname"]));
! } else {
! $templ->set_var('USERNAME', "");
! // $this->auth["error"] = "";
}
! // Display message string if present
! if (isset($this->auth["error"])) {
! $templ->set_var('ERROR', $this->auth["error"]);
} else {
! $templ->set_var('ERROR', "");
! }
! // Link to registration screen if enabled
! $templ->set_block("form","reg_block","regblock");
! if( $this->psl['auth.mode'] == "reg") {
! $templ->parse("regblock", "reg_block", true);
}
! AddClassRequirement("navbar",$this->psl['moduledir'] ."/". $this->psl['module']['NavBar'] ."/NavBar.class");
! $navbar = pslNew("NavBar");
! // display
! $templ->set_var(array(
! 'TOP' => getHeader('Login', 'Login') . $navbar->getNavBar('navbarBlockh'),
! 'CENTER_BLOCK_COLUMN' => $templ->parse('form','form'),
! 'BOTTOM' => getFooter()
! ));
!
! $templ->pparse('OUT','index');
!
! }
}
|