Esempio n. 1
0
 function temp_auth_actions()
 {
     require_once 'AMP/Auth/Password/Reset/Form.php';
     $password_reset_form = new AMP_Auth_Password_Reset_Form();
     $password_reset_form->Build();
     AMP_directDisplay($password_reset_form->execute());
 }
Esempio n. 2
0
<?php

require_once 'AMP/Base/Config.php';
require_once 'AMP/Auth/Password/Reset/Form.php';
require_once 'AMP/System/User/Profile/Profile.php';
require_once 'AMP/Auth/Handler.inc.php';
#require_once( 'AMP/BaseTemplate.php' );
#require_once( 'AMP/BaseModuleIntro.php' );
// define('AMP_AUTHENTICATION_DEBUG',true);
$AMP_Authen_Handler = new AMP_Authentication_Handler(AMP_Registry::getDbcon(), 'content');
if (!$AMP_Authen_Handler->is_authenticated()) {
    AMP_flashMessage('You need to submit another password reset request, as yours has expired');
    $AMP_Authen_Handler->do_login();
}
$password_reset_form = new AMP_Auth_Password_Reset_Form();
$password_reset_form->Build();
if ($_POST['new_password']) {
    $passwords = $password_reset_form->getValues();
    $user = new AMP_System_User_Profile(AMP_dbcon(), $AMP_Authen_Handler->userid);
    if ($user->reset_password($passwords, 'custom2')) {
        global $dbcon;
        $dbcon->Execute('DELETE FROM users_sessions where hash=' . $dbcon->qstr($hash));
        AMP_flashMessage('Password reset successful');
        AMP_redirect('profile.php');
    } else {
        AMP_flashMessage('Passwords do not match');
    }
}
echo $password_reset_form->execute();
require_once 'AMP/BaseFooter.php';