<?php if(!defined('IN_SDCMS')) exit;?>{include file="top.php"}
<title>忘记密码_{if strlen(sdcms[seo_title])>0}{sdcms[seo_title]}_{/if}{sdcms[web_name]}</title>
<meta name="keywords" content="{sdcms[seo_key]}">
<meta name="description" content="{sdcms[seo_desc]}">
</head>

<body>

    {include file="head.php"}
    
    <div class="bg_inner">
        <div class="width banner_inner">
            <div class="left">
                <ul>
                    <li class="hover"><a>忘记密码</a></li>
                </ul>
            </div>
        	<div class="right"><span class="am-icon-phone am-icon-fw"></span>{sdcms[ct_tel]}{block("inner_text")}</div>
        </div>
    </div>
    
    <!--中间部分开始-->
    <div class="bg_body bg_body_inner">   
        <div class="width">
        	<!--面包屑导航开始-->
            <div class="bread bread-1">
                <ul>
                    <li><a href="{$webroot}">首页</a></li>
                    <li>忘记密码</li>
                </ul>
            </div>
            <!--面包屑导航结束-->
            
            <!--忘记密码开始-->
            <div class="box-base row">
            	<div class="col-8 pl">
                	<!--左侧开始-->
                    <div class="menu menu-blue ">
                        <div class="menu-name">忘记密码</div>
                    </div>
                    <div class="pt-40">
                        <!--表单部分开始-->
                        <form method="post" class="ui-form ml-40">
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right">邮箱：</label>
                            <div class="col-5">
                                <input type="text" name="email" class="form-ip" placeholder="请输入注册时填写的邮箱" data-rule="邮箱:required;email;">
                            </div>
                        </div>
                        {if sdcms[user_getpass_auth]==1}
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right">验证码：</label>
                            <div class="col-5">
                                <div class="input-group">
                                    <input type="text" name="code" id="code" class="form-ip radius-right-none" placeholder="请输入验证码" data-rule="验证码:required;">
                                    <div class="code"><img src="{U('code')}" height="40" id="verify" title="点击更换验证码"></div>
                                </div>
                            </div>
                        </div>
                        {/if}
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right">邮箱验证码：</label>
                            <div class="col-5">
                                <div class="input-group">
                                    <input type="text" name="ecode" id="ecode" class="form-ip radius-right-none" placeholder="请输入邮箱验证码" data-rule="邮箱验证码:required;">
                                    <button type="button" class="after">发送验证码</button>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right">新密码：</label>
                            <div class="col-5">
                                <input type="password" name="password" id="password" class="form-ip" placeholder="请输入新密码" data-rule="新密码:required;password;">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right">确认密码：</label>
                            <div class="col-5">
                                <input type="password" name="repass" class="form-ip" placeholder="请再次输入密码" data-rule="确认密码:required;password;match(password)">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-2 col-form-label text-right"></label>
                            <div class="col-5">
                                <input type="submit" class="btn btn-blue" value="修改密码">
                            </div>
                        </div>
                        </form>
                        <!--表单部分结束-->
                    </div>
                    <!--左侧结束-->
                </div>
                <div class="col-4 pr pl-40 form-right">
                	<!--右侧开始-->
                    <h3>已有账户？</h3>
                    <a href="{N('login')}" class="btn btn-yellow">立即登录</a>
                    {if sdcms[api_qq_open]==1 || sdcms[api_weibo_open]==1 || sdcms[api_weixin_open]==1}
                    <div class="quick">
                        <h3>快捷登录</h3>
                        {if sdcms[api_qq_open]==1}<a href="{WEB_URL}{WEB_ROOT}api/login/qq/api.php" title="QQ登录"><span class="ui-icon-qq blue"></span>QQ登录</a>{/if}
                        {if sdcms[api_weibo_open]==1}<a href="{WEB_URL}{WEB_ROOT}api/login/weibo/api.php" title="微博登录"><span class="ui-icon-weibo red"></span>微博登录</a>{/if}
                        {if sdcms[api_weixin_open]==1}<a href="{WEB_URL}{WEB_ROOT}api/login/weixin/api.php" title="微信登录"><span class="ui-icon-weixin green"></span>微信登录</a>{/if}
                    </div>
                    {/if}
                    <!--右侧结束-->
                </div>
            </div>
            <!--忘记密码结束-->
        </div>
    </div>
    <!--中间部分结束-->

    {include file="foot.php"}

<script>
$(function()
{
	{if sdcms[user_getpass_auth]==1}
	$("#verify").click(function()
	{
		$(this).attr("src",$(this).attr("src")+"{iif(sdcms[url_mode]==1,"&","?")}rnd="+Math.round());
		$("#code").val("");
	});
	{/if}
	$(".after").click(function(event)
	{
		var that=$(this);
		var email=that.closest("form").find("[name=email]").val();
		if(email=='')
		{
			sdcms.warn('请输入邮箱');
			return false;
		}			
		var code='';
		{if sdcms[user_getpass_auth]==1}
		var code=that.closest("form").find("[name=code]").val();
		if(code=='')
		{
			sdcms.warn('请输入验证码');
			return false;
		}
		{/if}
		$.ajax(
		{
			url:"{U('getpasscode')}",
			type:'post',
			cache:false,
			dataType:'json',
			data:'email='+encodeURIComponent(email)+'&code='+encodeURIComponent(code),
			error:function(e){alert(e.responseText);},
			success:function(d)
			{
				if(d.state=='success')
				{
					that.backtime();
					sdcms.success(d.msg);
				}
				else
				{
                    {if sdcms[user_getpass_auth]==1}$("#verify").click();{/if}
					sdcms.error(d.msg);
				}
			}
		});
		
	});
	$(".ui-form").form(
	{
		type:2,
		align:'center',
		result:function(form)
		{
			$.ajax({
				type:'post',
				cache:false,
				dataType:'json',
				url:'{THIS_LOCAL}',
				data:$(form).serialize(),
				error:function(e){alert(e.responseText);},
				success:function(d)
				{
					if(d.state=='success')
					{
						sdcms.success(d.msg);
						setTimeout(function(){location.href='{N('login')}';},1500);
					}
					else
					{
						sdcms.error(d.msg);
					}
				}
			});
		}
	});
})
</script>
</body>
</html>