X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=wwwroot%2Finc%2Feventz%2Freset_password.inc;h=3c5f205ce43c5a58c3c4f2cef3f7d8c8e9a5251b;hb=71a598e9ace080c3a636a39cc110e1ed169a1a4e;hp=8c3554e561c53887216c1b3a42998e9bb533b76d;hpb=51ff32267c4949bad6a8dddc502cbc01ed56edc8;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/inc/eventz/reset_password.inc b/wwwroot/inc/eventz/reset_password.inc index 8c3554e..3c5f205 100644 --- a/wwwroot/inc/eventz/reset_password.inc +++ b/wwwroot/inc/eventz/reset_password.inc @@ -7,51 +7,30 @@ function reset_password() { $password1 = $_POST['new_password1']; $password2 = $_POST['new_password2']; - if ($login == '') { - $error="Please enter name or id"; - return false; - } - - if ($password1 == '' || $password2 == '') { - $error="Please enter password"; - return false; - } - - if ($password1 != $password2) { - $error = "The two passwords that you entered do not match."; - return false; - } - - switch ($login_type) { - case "name": - $set=$db->query("select * from users where login='$login'"); - $set->next(); - $user_name=$set->getString('login'); - $user_id=$set->getString('user_id'); - $hash=$set->getString('hash'); - break; - case "id": - $set=$db->query("select * from users where user_id='$login'"); - $set->next(); - $user_name=$set->getString('login'); - $user_id=$set->getString('user_id'); - $hash=$set->getString('hash'); - break; - } - - if ($hash != $vercode) { - $error="Bad verification code!"; - return false; - } - - $password = md5($password1); - $q="update users set password='$password' where user_id='$user_id'"; - $db->query($q); - - require(SYSTEM_ROOT.'/inc/ldap.inc'); - LDAPuser::change_pass_forced($user_id,$password1); - - $error="Password changed. Now you can login with your new password."; - return false; + if ($login == '') { + $error="Please enter name or id"; + return false; + } + + if ($password1 == '' || $password2 == '') { + $error="Please enter password"; + return false; + } + + if ($password1 != $password2) { + $error = "The two passwords that you entered do not match."; + return false; + } + + if ($login_type == 'id') { + $login_id=$login; + $login=''; + } else { + $login_id=0; + } + $error=nodes::resetPassword($login_id,$login,$vercode,$password1); + print "$error\n"; + + return 0; } -?> \ No newline at end of file +?>