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/Admin/Authentication.cshtml

162 lines
5.9 KiB

@Html.Partial("_Sidebar")
9 years ago
<div class="col-sm-8 col-sm-push-1">
9 years ago
<form class="form-horizontal" method="POST" action="/admin/authentication" id="mainForm">
<fieldset>
<legend>Authentication Settings</legend>
<div class="form-group">
9 years ago
<div class="checkbox">
<label>
@if (Model.UserAuthentication)
{
<input type="checkbox" id="userAuth" name="UserAuthentication" checked="checked">
9 years ago
<text>Enable User Authentication</text>
}
else
{
<input type="checkbox" id="userAuth" name="UserAuthentication">
9 years ago
<text>Enable User Authentication</text>
}
</label>
</div>
</div>
<div class="form-group">
9 years ago
<div class="checkbox">
<label>
@if (Model.UsePassword)
{
<input type="checkbox" id="UsePassword" name="UsePassword" checked="checked">
9 years ago
<text>Require users to login with their passwords</text>
}
else
{
<input type="checkbox" id="UsePassword" name="UsePassword">
9 years ago
<text>Require users to login with their passwords</text>
}
</label>
</div>
</div>
<div class="form-group">
9 years ago
<label for="authToken" class="control-label">Plex Authorization Token</label>
<div class="">
<input type="text" class="form-control-custom form-control" id="authToken" name="PlexAuthToken" placeholder="Plex Auth Token" value="@Model.PlexAuthToken">
</div>
</div>
<div class="form-group">
9 years ago
<label for="username" class="control-label">Username and Password</label>
<div>
9 years ago
<input type="text" class="form-control form-control-custom" id="username" name="Username" placeholder="Username">
</div>
9 years ago
<br/>
<div>
9 years ago
<input type="password" class="form-control form-control-custom" id="password" name="Password" placeholder="Password">
</div>
</div>
<div class="form-group">
9 years ago
<div class="">
<button id="requestToken" class="btn btn-primary-outline">Request Token <i class="fa fa-key"></i></button>
</div>
</div>
9 years ago
<br />
<br />
9 years ago
<p class="form-group">Current users that are allowed to authenticate: </p>
<div class="form-group">
9 years ago
<select id="users" multiple="" class="form-control-custom "></select>
</div>
<div class="form-group">
9 years ago
9 years ago
<div>
<button id="refreshUsers" class="btn btn-primary-outline">Refresh Users</button>
</div>
</div>
9 years ago
<p class="form-group">A comma separated list of users that you do not want to login.</p>
<div class="form-group">
9 years ago
<label for="deniedUsers" class="control-label">Denied Users</label>
<div >
<input type="text" class="form-control-custom form-control " id="DeniedUsers" name="DeniedUsers" placeholder="e.g. John, Bobby" value="@Model.DeniedUsers">
</div>
</div>
9 years ago
<br/>
<div>
</div>
<div class="form-group">
9 years ago
<div>
<button type="submit" class="btn btn-primary-outline">Submit</button>
</div>
</div>
</fieldset>
</form>
</div>
<script>
$(function () {
if ($('#PlexAuthToken')) {
loadUserList();
}
$('#refreshUsers').click(function () {
e.preventDefault();
loadUserList();
});
$('#requestToken').click(function (e) {
e.preventDefault();
var $form = $("#mainForm");
$.ajax({
type: $form.prop("method"),
url: "requestauth",
data: $form.serialize(),
dataType: "json",
success: function (response) {
console.log(response);
if (response.result === true) {
generateNotify("Success!", "success");
$('#authToken').val(response.authToken);
} else {
generateNotify(response.message, "warning");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
});
function loadUserList() {
$.ajax({
type: "Get",
url: "getusers",
dataType: "json",
success: function (response) {
if (response.length > 1) {
9 years ago
$(response).each(function () {
$('#users').append("<option>" + this + "</option>");
});
} else {
$('#users').append("<option>No Users, Please refresh!</option>");
}
},
error: function (e) {
console.log(e);
generateNotify("Something went wrong!", "danger");
}
});
}
});
</script>