@extends('install.base')

@section('content')
<h3>Create Admin</h3>
<form class="form-horizontal" method="post" action="create_admin.php">
<div class="form-group">
	<div class="col-md-2">Username</div>
	<div class="col-md-3"><input type="text" name="name" class="form-control" /></div>
</div>
<div class="form-group">
	<div class="col-md-2">Password</div>
	<div class="col-md-3"><input type="password" name="password" class="form-control" /></div>
	<div class="col-md-3" id="msg2"></div>
</div>
<div class="form-group">
	<div class="col-md-offset-2 col-md-2"><button type="submit" class="form-control">Create</button></div>
</div>
</form>
@endsection

@push('scripts')
<script type="text/javascript">
$(document).ready(function() {
	status = 0;
	$("input[name='password']").blur(function(e) {
		var result = zxcvbn($(this).val(), user_inputs=[$("input[name='name']").val()]);
		if (result.score < 3) {
			$('#msg2').html('<span class="label label-danger"><span class="glyphicon glyphicon-warning-sign"></span> Nivel ' + result.score + '</span>');
			status = 0;
		} else {
			if (result.score == 3) {
				$('#msg2').html('<span class="label label-warning"><span class="glyphicon glyphicon-ok"></span> Nivel ' + result.score + '</span>');
			} else {
				$('#msg2').html('<span class="label label-success"><span class="glyphicon glyphicon-ok"></span> Nivel ' + result.score + '</span>');
			}
			status = 1;
		}
	});
	$("form").submit(function(e) {
    if (!status) {
      e.preventDefault();
    }
    return status;
  });
};
</script>
@endpush
