<?php use itlife\user\User; infra_test(true); if ($_GET['email']) { User::sentEmail($_GET['email'], 'test'); header('Location: ?*user/sentEmail.php'); } ?> Sent: <input class="input" style="padding:1px 5px" placeholder="Email" type="email" name="useremail" onkeypress=" if (event.keyCode === 13) location.href='?*user/sentEmail.php?email='+this.value;">
<?php /** * Проверяем что нет ошибок и возвращаются ожидаемые данные User::get... */ use itlife\infra\ext\Ans; use itlife\user\User; infra_test(true); $ans = array(); $data = User::get(); if (!$data || sizeof($data) != 5 || !$data['result'] || !$data['id']) { return Ans::err($ans, 'User data get error'); } return Ans::ret($ans, 'Ok');
if ($newpassword != $repeatnewpassword) { return infra_err($ans, 'Passwords do not match.'); } infra_session_setPass($newpas); infra_view_setCookie(infra_session_getName('pass'), md5($newpas)); $msg = User::sentEmail($myemail, 'newpass'); return infra_ret($ans, 'Password changed.'); } } if ($type == 'signin') { if ($myemail) { return infra_err($ans, 'You are already logged in.'); } if ($submit) { $email = trim(strip_tags($_POST['email'])); if (!User::checkData($email, 'email')) { return infra_err($ans, 'You must specify a valid email address.'); } $userData = infra_session_getUser($email); $password = trim($_POST['password']); if (md5($email . $password) != $userData['password']) { return infra_err($ans, 'Wrong password or email.'); } infra_session_change($userData['session_id']); $ans['go'] = '?user'; return infra_ret($ans, 'You are logged in.'); } } if ($type == 'logout') { if (!$myemail) { return infra_err($ans, 'You are not logged in.');