<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dd_forget.aspx.cs" Inherits="HteamDd.Web.Web.Dd_password.Dd_forget" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>忘记密码|海客轻微博</title>
    <link href="/css/Dd_psw-4694.css" rel="stylesheet" type="text/css" />
    <script src="/jscript/jquery-1.4.2.js" type="text/javascript"></script>
    <script type="text/javascript">
        var jq = jQuery.noConflict();
        jq(document).ready(function () {
            jq("#btn_pass_submit").click(function () {
                if (check_mail()) {
                    jq("#form-tip-error").html("正在发送请稍后。。。");
                    jq.ajax({
                        type: "post",
                        url: '/ashx/Dd_psw_mail.ashx',
                        data: { user_email: jq("#get-password-input").val(), time: new Date().getDate() },
                        success: function (data) {
                            if (data == "success") {
                                jq("#form-tip-error").html("");
                                jq("#send").hide();
                                jq("#send_success").show();
                                jq("#sub-title").html("邮件已发送到" + jq("#get-password-input").val() + "，请点击其中的链接重设密码。");
                            }
                            else if (data == "send_error") {
                                alert('对不起今日邮件发送已达上线，你可能无法收到激活链接！');
                                window.location.href = '/Dd_login.aspx';
                            }
                            else if (data == "send_email_error") {
                                alert('邮件发送失败！');
                                window.location.href = '/Dd_login.aspx';
                            }
                            else if (data == "user_isnot") {
                                jq("#form-tip-error").html("该邮箱不存在，请输入注册时的邮箱~");
                            }
                            else {
                                jq("#form-tip-error").html("邮件发送失败~");
                            }
                        },
                        error: function () {
                            jq("#form-tip-error").html("邮件发送失败~");
                        }
                    });
                }
            })
        });
        function check_mail() {
        
            if (jq("#get-password-input").val() == "") {
                jq("#form-tip-error").html("填个邮箱呗~");
                return false;
            }
            else {
                var reg = /^[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/;
                if (!reg.test(jq("#get-password-input").val())) {
                    jq("#form-tip-error").html("邮箱格式不正确！");
                    return false;
                }
                else {
                    jq("#form-tip-error").html("");
                    return true;
                }
            }
        }
    </script>
</head>
<body>
    <div id="wrap">
        <div id="header">
            <div id="logo-holder">
                <h1 id="logo">
                    <a href="/Dd_login.aspx"></a>
                </h1>
            </div>
        </div>
        <div id="content">
            <h3 class="info-title">
                重设密码</h3>
            <div class="reg-content request-reset-pass" id="send">
                <p class="sub-title">
                    请输入你的注册邮箱</p>
                <div class="form-item" >
                    <input id="get-password-input" class="reg-input-text" type="text" value="" name="account"/>
                    <input id="btn_pass_submit" class="get-password-submit" type="submit" value="发送"/>
                </div>
                <div class="form-tip">
                    <p class="form-tip-error" id="form-tip-error"></p>
                </div>
            </div>
            <div class="reg-content request-reset-pass" id="send_success" style=" display:none;">
                <p class="sub-title" id="sub-title"></p>
            </div>
        </div>
    </div>
</body>
</html>
