<h2>安全设置</h2>
<div class="panel panel-default">
	<div class="panel-body">
		<form role="form" name="changePasswordForm" ng-controller="personalController" ng-submit="modifyAuth(user)" >
            <h3 class="page-header">用户{[ currentUser.username ]}</h3>
			<div class="row">
				<div class="col-md-10">
					<div class="form-group has-feedback">
						<label>绑定邮箱</label>
						<input
							class="form-control"
							name="email"
							type="email"
							ng-model="user.email"
							ng-blur="onlyEmail(user.email)"
							ng-focus="isEmail=disabled"
							required
						/>
						<!--失去焦点后验证邮箱唯一性开始-->
						<span
							class="glyphicon glyphicon-ok form-control-feedback"
                  			ng-show="changePasswordForm.email.$dirty && changePasswordForm.email.$valid && isEmail==true"
                  			style="color: green;">
						</span><!--可用-->
						<span
							class="glyphicon glyphicon-remove form-control-feedback"
                  			ng-show="changePasswordForm.email.$dirty && changePasswordForm.email.$valid && isEmail==false"
                  			style="color: red;">
						</span><!--不可用-->
						<!--失去焦点后验证邮箱唯一性结束-->
						<span ng-show="changePasswordForm.email.$dirty && changePasswordForm.email.$invalid">
							<span ng-show="changePasswordForm.email.$error.email" style="color: red;">输入正确的邮箱</span>
						</span>
					</div>
				</div>
			</div>
			<br />
			<div class="row">
				<div class="col-md-10">
					<div class="form-group has-feedback">
						<label>当前密码</label>
						<input
							class="form-control"
							type="password"
							name="password0"
							ng-model="user.password0"
							ng-minlength="6"
							ng-maxlength="12"
							my-focus
							required
						/>
						<span
							class="glyphicon glyphicon-ok form-control-feedback"
                  			ng-show="changePasswordForm.password0.$dirty && changePasswordForm.password0.$valid && changePasswordForm.password0.$focused==false"
                  			style="color: green;">
						</span><!--可用-->
						<span ng-show="changePasswordForm.password0.$dirty && changePasswordForm.password0.$invalid">
							<span ng-show="changePasswordForm.password0.$error.minlength" style="color: red;">输入的密码需大于6位</span>
							<span ng-show="changePasswordForm.password0.$error.maxlength" style="color: red;">输入的密码需小于12位</span>
						</span>
					</div>
				</div>
			</div>
			<br />
			<div class="row">
				<div class="col-md-10">
					<div class="form-group has-feedback">
						<label>修改密码</label>
						<input
							class="form-control"
							type="password"
							name="password"
							ng-model="user.password"
							ng-minlength="6"
							ng-maxlength="12"
							my-focus
							required
						/>
						<span
							class="glyphicon glyphicon-ok form-control-feedback"
                  			ng-show="changePasswordForm.password.$dirty && changePasswordForm.password.$valid && changePasswordForm.password.$focused==false && user.password != user.password0"
                  			style="color: green;">
						</span><!--可用-->
						<span
							ng-show="changePasswordForm.password.$dirty && changePasswordForm.password0.$valid && user.password == user.password0"
							 style="color: red;">
							新密码不能与旧密码相同。
						</span>
						<span ng-show="changePasswordForm.password.$dirty && changePasswordForm.password.$invalid">
							<span ng-show="changePasswordForm.password.$error.minlength" style="color: red;">输入的密码需大于6位</span>
							<span ng-show="changePasswordForm.password.$error.maxlength" style="color: red;">输入的密码需小于12位</span>
						</span>
					</div>
				</div>
				<div class="col-md-10">
					<div class="form-group has-feedback">
						<label>确认密码</label>
						<input
							class="form-control"
							type="password"
							name="passwordRepeat"
							ng-model="user.passwordRepeat"
							my-focus
							required
						/>
						<span
							class="glyphicon glyphicon-ok form-control-feedback"
                  			ng-show="changePasswordForm.passwordRepeat.$dirty && changePasswordForm.passwordRepeat.$valid && changePasswordForm.passwordRepeat.$focused==false && user.passwordRepeat == user.password"
                  			style="color: green;">
						</span><!--可用-->
						<span
							ng-show="changePasswordForm.passwordRepeat.$dirty && changePasswordForm.password.$valid && user.passwordRepeat != user.password"
							 style="color: red;">
							两次输入的密码不一致。
						</span>
					</div>
				</div>
			</div>
			<br />
			<div class="row">
				<div class="col-md-20">
					<button class="btn btn-success" type="submit">确认修改</button>
				</div>
			</div>
		</form>
	</div>
</div>
