<div class="content login m-0-b">
	<div class="row section-title p-5-l p-5-r p-5-t p-0-b text-center">
		<div class="col">
			<h1 class="m-0-t font-weight-bold">Reset My Password</h1>
			<p class="m-0-b"><?php echo (!$error) ? ((isset($success) && $success) ? "Successfully reset your password. You may proceed to login" : "Enter your new password") : "<span class=\"text-red\">".$error."</span>"; ?></p>
		</div>
	</div>
	
	<div class="row m-5-y">
		<div class="col-md-offset-4 col-md-4">
			<?php
			if($error) {
				?>
				<div class="text-center m-1-t">I really forgot my password! <a href="<?php echo base_url(); ?>login/forgotpassword" target="_blank">Reset my password</a></div>
				<div class="text-center m-1-t">I remember my password! <a href="<?php echo base_url(); ?>login/index" target="_blank">Login Now</a></div>
				<div class="text-center m-1-t">Don't have an account? <a href="<?php echo base_url(); ?>registration">Sign Up now for FREE!!!</a></div>
				<?php
			} else {
				if(isset($success) && $success) {
					?>
					<div class="p-1-y text-center">
						<a class="btn btn-success launch-now p-5-x p-2-y p-xs-1-x p-xs-1-y" href="<?php echo base_url(); ?>login/index">
							<h1>Login Now&nbsp;<i class="fa fa-sign-in"></i></h1>
						</a>
					</div>
					<?php
				} else {
					?>
					<form class="form-horizontal registration-form" method="post" action="<?php echo base_url(); ?>login/resetpassword/<?php echo $code; ?>" id="registration_form">
						<input type="hidden" name="user" value="<?php echo $account; ?>" />
						<div class="box box-flat">
							<div class="box-body">							
								<div class="row">
									<div class="col message <?php echo ($error) ? "fail" : NULL; ?> text-center" id="message">
									<?php echo ($error) ? $error : NULL; ?>
									</div>
								</div>
								
								<div class="helper m-2-y">* - Required</div>
								
								<div class="form-group">
									<label class="col-xs-12 required registration-form-label">New Password</label>
									<div class="col-xs-12">
										<input type="password" class="form-control validate[required] registration-form-input" name="newpassword" id="new_password_input" value="" />
									</div>
								</div>
								
								<div class="form-group">
									<label class="col-xs-12 required registration-form-label">Confirm Password</label>
									<div class="col-xs-12">
										<input type="password" class="form-control validate[required] registration-form-input" name="confirmpassword" id="confirm_password_input" value="" />
									</div>
								</div>
							</div>
							
							<div class="box-footer p-1-l p-1-r">
								<div class="flex-btn-group">
									<button type="submit" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Reset My Password</button>
									<a href="<?php echo base_url(); ?>" class="btn btn-danger"><i class="fa fa-backward"></i>&nbsp;Back</a>
								</div>
								
								<div class="text-center m-1-t">I remember my password! <a href="<?php echo base_url(); ?>login/index" target="_blank">Login Now</a></div>
								<div class="text-center m-1-t">Don't have an account? <a href="<?php echo base_url(); ?>registration">Sign Up now for FREE!!!</a></div>
							</div>
						</div>
					</form>
					<?php
				}
			}
			?>
		</div>
	</div>

	<!-- SIGN UP -->
	<div class="signup-button p-5-l p-5-r p-2-t p-2-b text-center">
		<a href="<?php echo base_url(); ?>registration" class="btn btn-success"><i class="fa fa-check"></i>&nbsp;Free Sign Up Now</a>
	</div>
</div>

<script>
$(function() {
	$('form#registration_form').off('submit').on('submit',function() {		
		if ($(this).validationEngine('validate')) {
			var proceed = true;
			
			var newpassword = $.trim(	$('#new_password_input').val()	);
			if(newpassword == "") {
				proceed =  false;
				$('#new_password_input').validationEngine('showPrompt', 'Please enter new password', 'load','bottomRight',1);
				$('#new_password_input').parents('.form-group').eq(0).addClass('has-error');
			}
			if(!proceed) return false;
			
			var confirmpassword = $.trim(	$('#confirm_password_input').val()	);
			if(confirmpassword == "") {
				proceed =  false;
				$('#confirm_password_input').validationEngine('showPrompt', 'Please enter password confirmation', 'load','bottomRight',1);
				$('#confirm_password_input').parents('.form-group').eq(0).addClass('has-error');
			}
			if(!proceed) return false;
			
			if(newpassword != confirmpassword) {
				proceed =  false;
				$('#new_password_input').validationEngine('showPrompt', 'Password and confirmation not matched', 'load','bottomRight',1);
				$('#confirm_password_input').validationEngine('showPrompt', 'Password and confirmation not matched', 'load','bottomRight',1);
				$('#new_password_input').parents('.form-group').eq(0).addClass('has-error');
				$('#confirm_password_input').parents('.form-group').eq(0).addClass('has-error');
			}
			if(!proceed) return false;
			
			return true;
		} else {
			return false;
		}
		return true;
	});
});
</script>




























