You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/PlexRequests.UI/Views/UserLogin/Index.cshtml

70 lines
2.4 KiB

@using PlexRequests.UI.Helpers
<div class="home">
<h1>Login</h1>
<div>
<p>
Want to watch a movie or tv show but it's not currently on Plex?
Login below with your Plex.tv username and password! <span title="Your login details are only used to authenticate your Plex account."><i class="fa fa-question-circle"></i></span>
</p>
</div>
<form method="POST" id="loginForm">
<div>
<div>
<label>Plex.tv Username </label>
</div>
<div>
<input class="form-control form-control-custom" type="text" name="Username" placeholder="Username" />
</div>
</div>
<br />
@if (Model.UsePassword)
{
<div>
<div>
<label> Password </label>
</div>
<div>
<input class="form-control form-control-custom" name="Password" type="password" placeholder="Password"/>
</div>
</div>
<br />
}
<button id="loginBtn" class="btn btn-success-outline" type="submit"><i class="fa fa-user fa-fw"></i> Sign In</button>
</form>
</div>
<script>
$(function () {
var base = '@Html.GetBaseUrl()';
$('#loginBtn').click(function (e) {
e.preventDefault();
var $form = $("#loginForm");
var formData = $form.serialize();
var dtOffset = new Date().getTimezoneOffset();
formData += ('&DateTimeOffset=' + dtOffset);
var url = createBaseUrl(base, '/search');
$.ajax({
type: $form.prop("method"),
url: $form.prop("action"),
data: formData,
dataType: "json",
success: function (response) {
console.log(response);
if (response.result === true) {
window.location.replace(url);
} else {
generateNotify(response.message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
});
</script>