<?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['error'] = '请输入11位手机号';
    } else if (!$code) {
        $context['error'] = '请输入验证码';
    } else if (!$password) {
        $context['error'] = '请输入新密码';
    } else {
        $search_code = TospurDao::search_tospur_verify($phone, $code);
        if ($code == $search_code) {
            wp_set_password($password, $user->data->ID);
            TospurDao::update_tospur_verify($phone);
            $context['error'] = '成功修改密码';
        } else {
            $context['error'] = '验证码错误';
        }
    }
}
Timber::render('forget.html', $context);

?>