<?php $this->layout='login'; ?>
<div class="users form">
	<form method="post" role="form" action="<?php echo $this->createUrl('RecuperarSenha/alterar'); ?>">
		<fieldset id="step-2">
			<legend>Criar nova senha</legend>
			<?php
			foreach(Yii::app()->user->getFlashes() as $key => $message) {
				echo '<div class="alert alert-' . $key . '">' . $message . "</div>\n";
			}
			if(!empty($model->getErrors())) {
				$summary = "";
				foreach($model->getErrors() as $field => $errors) {
					$summary .= implode("<br />", $errors)."<br />";
				}
				echo '<div class="alert alert-danger">' . $summary . "</div>\n";
			}
			?>
			<p>Preencha os campos abaixo para alterar sua senha</p>
			
			<input type="hidden" name="RecuperarSenha[REC_TOKEN]" class="form-control" value="<?php echo $model->REC_TOKEN; ?>" />

			<div class="form-group has-feedback text required">
				<label class="control-label sr-only" for="usuario">Usuário</label>
				<div class="input-group">
					<input type="text" name="RecuperarSenha[FUN_USUARIO]" class="form-control" placeholder="Usuário" required="required" minlength="4" maxlength="50" id="usuario" value="<?php echo $model->FUN_USUARIO; ?>" />
					<span class="input-group-addon">
						<i class="form-control-feedback glyphicon glyphicon-user"></i>
					</span>
				</div>
			</div>
			<div class="form-group has-feedback password required">
				<label class="control-label sr-only" for="senha">Senha</label>
				<div class="input-group">
					<input type="password" name="RecuperarSenha[FUN_SENHA]" class="form-control" placeholder="Senha" required="required" minlength="4" maxlength="50" id="senha" value="<?php echo $model->FUN_SENHA; ?>"/>
					<span class="input-group-addon">
						<i class="form-control-feedback glyphicon glyphicon-lock"></i>
					</span>
				</div>
			</div>

			<div class="form-group has-feedback password required">
				<label class="control-label sr-only" for="confirmacao">Confirmação de senha</label>
				<div class="input-group">
					<input type="password" name="RecuperarSenha[FUN_CONFIRMACAO]" class="form-control" placeholder="Confirmação de senha" required="required" minlength="4" maxlength="50" id="confirmacao" value="<?php echo $model->FUN_CONFIRMACAO; ?>"/>
					<span class="input-group-addon">
						<i class="form-control-feedback glyphicon glyphicon-lock"></i>
					</span>
				</div>
			</div>
			<div class="row">
				<div class="col-xs-4 pull-right">
					<button type="submit" class="btn-block btn-flat btn btn-primary">Enviar</button>
				</div>
			</div>
		</fieldset>
	</form>
	<a href="index.php?r=site/login" class="link-form">Fazer login</a>
</div>
<script type="text/javascript">
	$(document).ready(function() {
		$('#usuario').focus();
	});
</script>