<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;

$this->title = 'Forget Password - Classic IAS Academy';
\Yii::$app->view->registerMetaTag([
    'name' => 'description',
    'content' => 'Forget Password - Classic IAS Academy',
]);
\Yii::$app->view->registerMetaTag([
    'name' => 'keywords',
    'content' => 'Forget Password - Classic IAS Academy',
]);
?>
<section style="background-image: linear-gradient(to bottom right, #00CFFF, #0C4470);">
	<div class="container" style="display:flex; padding:15px">
		<div class="col-sm-6" style="position:relative; margin:auto">
			<div style="background:#fff; padding:50px; border-radius:5px">
				<h1 style="font-weight:bold; text-align:center; padding:15px">Forgot Password!</h1>
				<p class="text-center" style="font-size:18px">Enter your Registered Phone Number:</p>
			    <?php if(\Yii::$app->session->hasFlash('danger')) { ?>
				<p class="text-center" style="font-size:16px;color:red;"><?php echo \Yii::$app->session->getFlash('danger'); ?></p>
				<?php } ?>
				<?php if(\Yii::$app->session->hasFlash('sendre')) { ?>
				<p class="text-center" style="font-size:16px;color:green;"><?php echo \Yii::$app->session->getFlash('sendre'); ?></p>
				<?php } ?>
				<?php $form = ActiveForm::begin(['method' => 'post',]); ?>
					  <div class="form-group">
						<input type="text" name="phone" maxlength="10" onblur = 'phonenumber(this.value)' id="telephone_contact" onkeypress = 'return isNumberKey(event)'  placeholder="Phone Number" class="form-control" required="required">
					  </div>
					  
					  <div style="text-align:center; background:#1465A1; padding:6px; border-radius:5px">
						<input type="submit" name="submit" value="SUBMIT" style="color:#fff; text-decoration:none; font-size:18px;background: #1465A1;border: none;">
					  </div>
				<?php ActiveForm::end(); ?>
				<div style="padding:20px; text-align:center;">
				    <?=Html::a('Back To Login', ['/security/login'])?>
				</div>
					
			</div>
		</div>
	</div>
</section>

<div style="height:20px"></div>
<script>
function isNumberKey(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}
function phonenumber(inputtxt)  
    {  
      var phoneno = /^\d{10}$/;  
      if(inputtxt.match(phoneno))  
      {  
		 document.getElementById('telephone_contact').setCustomValidity('');
		 return true;  
		}  
	else  
		{  
		 document.getElementById('telephone_contact').setCustomValidity('You have entered 10 digit number!');
		 return false;  
		}   
   }
</script>