<?php 
/**
 * Screen login
 * @version 1.0.1
 * @package Base
 * 
*/
$user = $this->data['user'];
$_SESSION['captcha'] = simple_php_captcha();

?>

	<?php  if ($this->data['message_unblock_requested']) { ?>
		<p style="padding:5px;text-align:center;padding:20px" class="bg-warning"><?= R('text_requested_unblock') ?></p>
	
	<?php 	return;
			} ?>
			
	<?php  if ($this->data['message_password_requested']) { ?>
		<p style="padding:5px;text-align:center;padding:20px" class="bg-warning"><?= R('text_requested_password') ?></p>
	
	<?php 	return;
			} ?>		

			
	<?php if ($this->data['error']==1) { ?>
	        	<p style="padding:5px" class="bg-danger"><?= R('text_login_error') ?></p>
	        	
   <?php } ?>		
   <?php if ($this->data['error']==3) { ?>
	        	<p style="padding:5px" class="bg-danger"><?= R('text_captcha_error') ?></p>
	        	
   <?php } ?>	
			
   <form class="form-signin" action="<?= __SITEBASE ?>/login/authenticate" method="post" role="form" autocomplete="off">
        <h1 class="form-signin-heading"><?= __NAME ?></h1>
        
        
        <?php if ($this->data['error']==2) { ?>
        
        	<p style="padding:5px" class="bg-danger"><?= R('text_user_blocked') ?></p>
        	<div class="form-control" ><?= $user->username ?></div>
        		<p></p>
        	<a href="<?= __SITEBASE ?>/login/requestunblock?u=<?= $user->username ?>" class="btn btn-lg btn-primary btn-block" type="submit"><?= R('button_request_reactivation') ?></a>
     
		 <?php } ?>
    
       
       <?php 
	   
			if (!$this->data['error']||$this->data['error']==1|| $this->data['error']==3) { ?>
       
        <input name="username"  autocomplete="off" type="text" class="form-control" placeholder="<?= R('label_username') ?>" required autofocus>
        <input name="password" autocomplete="off" type="password" class="form-control" placeholder="<?= R('label_password') ?>" required>
        <?PHP if (__CAPTCHA_LOGIN){ ?>
			<p>&nbsp;</p>
			<img src="<?= $_SESSION['captcha']['image_src'] ?>">
			<p>&nbsp;</p>
			<input name="captcha" type="text" class="form-control" placeholder="<?= R('label_captcha') ?>" required>
			<p>&nbsp;</p>
		<?php } ?>
		<button class="btn btn-lg btn-primary btn-block" type="submit"><?= R('button_login') ?></button>
        <p>&nbsp;</p>
        <p style="text-align: center"><a href="<?= __SITEBASE ?>/login/lostpassword"><?= R('text_lost_password') ?></a></p>
       
        <?php } 
		?>
       
   </form>