<!--
	<?php
		global $type,$uid,$t_template;
		if($_G['GET']['TYPE']=='verify'&&Cnum($_G['GET']['UID'])){
			$t_template="
			<tr>
				<td colspan='2' style='text-align:center;font-size:12px'>
					我们已经把校验码发送到您的邮箱，请注意查收！<input type='hidden' class='pk-textbox pk-radius-4' name='uid' value='{$_G['GET']['UID']}' autocomplete='off' required>
				</td>
			</tr>
			<tr>
				<td>校验码：</td>
				<td>
					<input type='text' class='pk-textbox pk-radius-4' name='mailverifycode' autocomplete='off' value='{$_G['GET']['MAILVERIFYCODE']}' placeholder='已发送至您的邮箱' required>
				</td>
			</tr>
			<tr>
				<td>新密码：</td>
				<td><input type='password' class='pk-textbox pk-radius-4' name='password' value='' autocomplete='off' placeholder='5-16位任意字符' required></td>
			</tr>
			<tr>
				<td>确认密码：</td>
				<td><input type='password' class='pk-textbox pk-radius-4' name='password2' value='' autocomplete='off' placeholder='重复输入一遍新密码' required></td>
			</tr>
			";
		}else{
			$t_template="
			<tr>
				<td colspan='2' style='text-align:center;font-size:12px'>
					请输入要找回密码的用户名及正确邮箱地址
				</td>
			</tr>
			<tr>
				<td>用户名：</td>
				<td>
					<input type='text' class='pk-textbox pk-radius-4' name='username' value='' autocomplete='off' placeholder='要找回密码的用户名' required>
				</td>
			</tr>
			<tr>
				<td>邮箱：</td>
				<td><input type='email' class='pk-textbox pk-radius-4' name='mail' value='' autocomplete='off' placeholder='该用户注册时所填写的邮箱地址' required></td>
			</tr>
			";
		}
	?>
-->
<style>
	.forgotpassword_table {
		margin: 0 auto;
	}
	
	.forgotpassword_table tr td {
		padding: 4px;
		vertical-align: middle;
	}
	
	.forgotpassword_table tr td:nth-child(1) {
		text-align: right;
		width: 88px;
	}
	
	.forgotpassword_table tr td:nth-child(2) {
		width: 258px;
	}
</style>
<div class="forgotpassword" style="padding:30px 0;">
	<div class="pk-padding-10 pk-text-center"><b>忘记密码</b></div>
	<form name="form_forgotpassword" method="post" action="index.php?c=app&a=systememail:forgotpassword">
		<table class="forgotpassword_table">
			{$t_template}
			<tr>
				<td>验证码：</td>
				<td>
					<input class="pk-textbox pk-radius-4" type="text" name="verifycode" autocomplete="off" required>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<img class="pk-cursor-pointer" alt="验证码" src="index.php?c=app&a=verifycode:index&type=forgotpassword&rnd={$_G['RND']}" onclick="this.src='index.php?c=app&a=verifycode:index&type=forgotpassword&rnd='+Math.random()" title="重新获取验证码">
				</td>
			</tr>
			<tr>
				<td colspan="2" style="text-align: center;padding: 10px;">
					<input id="fotgetpasswordbtn" type="button" class="pk-btn pk-btn-primary pk-radius-4" value="确认">
				</td>
			</tr>
		</table>
	</form>
</div>
<script>
	$(function() {
		$('#fotgetpasswordbtn').click(function() {
			if("{$_G['GET']['TYPE']}" == "verify") {
				if(!trim(form_forgotpassword.mailverifycode.value) || !trim(form_forgotpassword.password.value) || !trim(form_forgotpassword.verifycode.value)) {
					pkalert('请输入完整信息');
					return false;
				}
				if(form_forgotpassword.password.value != form_forgotpassword.password2.value) {
					pkalert('两次密码不一致');
					return false;
				}
			} else {
				if(!trim(form_forgotpassword.username.value) || !trim(form_forgotpassword.mail.value) || !trim(form_forgotpassword.verifycode.value)) {
					pkalert('请输入完整信息');
					return false;
				}
			}
			form_forgotpassword.submit();
		})
	})
</script>