<?php

$context = array();
$context['theme'] = get_template_directory_uri();
$context['url'] = home_url();
if ($_POST) {
    $phone = $_POST['phone'];
    $code = $_POST['code'];
    $password = $_POST['password'];
    if (!$phone) {
        $context['phoneError'] = '请输入11位手机号';
    } else if (!$code) {
        $context['codeError'] = '请输入验证码';
    } else if (!$password) {
        $context['passwordError'] = '请输入新密码';
    } else {
        $search_code = dao::search_tospur_verify($phone, $code);
        if ($code == $search_code) {
            wp_set_password($password, $user->data->ID);
            dao::update_tospur_verify($phone);
            echo '成功修改密码';
        } else {
            $context['codeError'] = '请输入正确的验证码';
        }
    }
}
Timber::render('forget.html', $context);

?>