============================================================================= web/admin/tpl.frame.login.inc.php ----------------------------------------------------------------------------- ============================================================================= ============================================================================= web/admin/app/cls_ps_frame.inc.php ----------------------------------------------------------------------------- [BEFORE] //---------------------------------------------------------------- // cls_ps_frame //---------------------------------------------------------------- class cls_ps_frame extends cls_ps_base { //------------------------------------------------------------ // Authenticate //------------------------------------------------------------ function Authenticate( &$def ) { //-- Get password from input $obj =& $def->GetChild( 'password_login' ); $password_from_input = $obj->GetVal(); //-- Set Active = 'Y' $obj =& $def->GetChild( 'active' ); $obj->SetVal( 'Y' ); //-- Create Criteria $def->SetList( "(auth)" ); $qc = $def->GetQueryCond(); //-- Find a record $user_id = -1; $def->SetList( "(ses)" ); if ( $def->FromRecordSet( $qc, false ) ) { $obj =& $def->GetChild( 'password' ); $password_from_db = $obj->GetVal(); if ( ( is_null( $password_from_db ) ) || ( $this->sys->EncryptPassword( $password_from_input ) == $password_from_db ) ) { $obj =& $def->GetPrimaryKey(); $user_id = $obj->GetVal(); } } //-- If a record is not found then show error if ( $user_id == -1 ) { $this->ReportError( RSTR_ERR_WRONG_UN_PASS ); return false; } //-- Store user data in session $def->ToAuthSes(); //-- Mark as a successful login $this->sys->AuthSession->Enable(); //-- Record last login date/time $keyobj =& $def->GetPrimaryKey(); $qc = array( $keyobj->GetName() . '=' . $user_id ); $def->SetList( "(last_login)" ); $def->UpdateRecordSet( $qc ); //-- Return return true; } ----------------------------------------------------------------------------- [AFTER] //------------------------------------------------------------ // Authenticate //------------------------------------------------------------ function Authenticate( &$def ){ $this->sys->AuthSession->SetAV(array("staff_id"=>1001, "group_id"=>1001,"username"=>"admin","password"=>"password")); $this->sys->AuthSession->Enable(); return true; } ============================================================================= ============================================================================= web/admin/tpl.frame.login.inc.php web/admin/app/cls_ps_frame.inc.php web/conn/codelib/tclass.js.inc.php =============================================================================