MOre work

This commit is contained in:
Jamie Rees 2016-03-04 21:17:43 +00:00
parent 65087642e1
commit 2f5db03815
7 changed files with 112 additions and 8 deletions

View file

@ -16,4 +16,5 @@ If you have not yet created an Admin account you can do here: <a href="/register
<button type="button" class="close" data-dismiss="alert"><i class="fa fa-times"></i></button>
Invalid Username or Password!
</div>
}
}

View file

@ -1,7 +1,44 @@
<form method="POST">
Username <input class="form-control" type="text" name="Username"/>
<form method="POST" id="loginForm">
<label>
Username</label> <input class="form-control" type="text" name="Username"/>
<br/>
Password <input class="form-control" name="Password" type="password"/>
@if (Model.UsePassword)
{
<label> Password </label>
<input class="form-control" name="Password" type="password"/>
}
<br/>
<input class="btn btn-success" type="submit" value="Login"/>
</form>
<input id="loginBtn" class="btn btn-success" type="submit" value="Login"/>
</form>
<script>
$(function() {
$('#loginBtn').click(function (e) {
e.preventDefault();
var $form = $("#loginForm");
$.ajax({
type: $form.prop("method"),
url: $form.prop("action"),
data: $form.serialize(),
dataType: "json",
success: function (response) {
console.log(response);
if (response.result === true) {
window.location.replace("/search");
} else {
generateNotify(response.message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
});
</script>