mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Remove PMS token from UI
This commit is contained in:
parent
b7937b8740
commit
3c3d72850f
3 changed files with 26 additions and 40 deletions
|
@ -969,20 +969,11 @@
|
|||
<label for="pms_token">Plex.tv Account Token</label>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="input-group">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-form reveal-token" type="button"><i class="fa fa-eye-slash"></i></button>
|
||||
</span>
|
||||
<input type="password" class="form-control" id="pms_token" name="pms_token" value="${config['pms_token']}" data-parsley-trigger="change" data-parsley-errors-container="#pms_token_error" required readonly>
|
||||
<span class="input-group-btn">
|
||||
<button id="sign-in-plex" class="btn btn-form" type="button">Fetch Token</button>
|
||||
</span>
|
||||
<button id="sign-in-plex" class="btn btn-form" type="button">Fetch New Token</button>
|
||||
<span style="margin-left: 10px; display: none;" id="pms-token-status"></span>
|
||||
</div>
|
||||
<span class="form-control-feedback" id="token_verify" aria-hidden="true" style="right: 80px;"></span>
|
||||
</div>
|
||||
<div id="pms_token_error" class="alert alert-danger settings-alert" role="alert"></div>
|
||||
</div>
|
||||
<p class="help-block">Token for Plex.tv authentication.</p>
|
||||
<p class="help-block">Fetch a new Plex.tv account authentication token.</p>
|
||||
</div>
|
||||
<input type="hidden" id="pms_client_id" name="pms_client_id" value="${config['pms_client_id']}">
|
||||
|
||||
|
@ -1622,7 +1613,7 @@
|
|||
</div>
|
||||
<div id="token_error_bar" style="display: none;">
|
||||
<i class="fa fa-exclamation-triangle"></i> Your Plex.tv token is no longer valid.<br>
|
||||
Please <a data-tab-destination="plex_media_server" data-target="pms_token">fetch a new token</a>.
|
||||
Please <a data-tab-destination="plex_media_server" data-target="sign-in-plex">fetch a new token</a>.
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
|
@ -2630,12 +2621,9 @@ $(document).ready(function() {
|
|||
});
|
||||
var select_pms = $select_pms[0].selectize;
|
||||
|
||||
function getServerOptions(token) {
|
||||
function getServerOptions() {
|
||||
$.ajax({
|
||||
url: 'discover',
|
||||
data: {
|
||||
token: token
|
||||
},
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
var existing_ip = $('#pms_ip').val();
|
||||
|
@ -2748,16 +2736,16 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
function OAuthPreFunction() {
|
||||
$("#token_verify").html('<i class="fa fa-refresh fa-spin"></i>').fadeIn('fast');
|
||||
$("#pms-token-status").html('<i class="fa fa-refresh fa-spin"></i> Waiting for authentication...').fadeIn('fast');
|
||||
}
|
||||
function OAuthSuccessCallback(authToken) {
|
||||
$("#pms_token").val(authToken);
|
||||
$("#token_verify").html('<i class="fa fa-check"></i>').fadeIn('fast');
|
||||
$('#token_error_bar').hide();
|
||||
$.post('save_pms_token', { token: authToken });
|
||||
$("#pms-token-status").html('<i class="fa fa-check"></i> Authentication successful.').fadeIn('fast');
|
||||
$("#token_error_bar").hide();
|
||||
getServerOptions(authToken);
|
||||
}
|
||||
function OAuthErrorCallback() {
|
||||
$("#token_verify").html('<i class="fa fa-close"></i>').fadeIn('fast');
|
||||
$("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> Error communicating with Plex.tv.').fadeIn('fast');
|
||||
}
|
||||
|
||||
$('#sign-in-plex').click(function() {
|
||||
|
|
|
@ -111,9 +111,9 @@
|
|||
Tautulli requires a Plex.tv account. Click the button below to sign in on Plex.tv. You may need to allow popups in your browser.
|
||||
</p>
|
||||
</div>
|
||||
<input type="hidden" name="pms_token" id="pms_token" value="" data-validate="validatePMStoken">
|
||||
<input type="hidden" id="pms_token_validated" value="0" data-validate="validatePMStoken">
|
||||
<input type="hidden" name="pms_client_id" id="pms_client_id" value="${config['pms_client_id']}">
|
||||
<a class="btn btn-dark" id="sign-in-plex" href="#" role="button">Sign In with Plex</a>
|
||||
<button id="sign-in-plex" class="btn btn-form" type="button">Sign In with Plex</button>
|
||||
<span style="margin-left: 10px; display: none;" id="pms-token-status"></span>
|
||||
</div>
|
||||
|
||||
|
@ -308,7 +308,7 @@
|
|||
var valid_pms_token = el.val();
|
||||
var retValue = {};
|
||||
|
||||
if (valid_pms_token === "") {
|
||||
if (valid_pms_token === 0) {
|
||||
retValue.status = false;
|
||||
retValue.msg = "Please authenticate.";
|
||||
$("#pms-token-status").html('<i class="fa fa-exclamation-circle"></i> Please authenticate.');
|
||||
|
@ -477,13 +477,9 @@ $(document).ready(function() {
|
|||
});
|
||||
var select_pms = $select_pms[0].selectize;
|
||||
|
||||
function getServerOptions(token) {
|
||||
/* Set token and returns server options */
|
||||
function getServerOptions() {
|
||||
$.ajax({
|
||||
url: 'discover',
|
||||
data: {
|
||||
token: token
|
||||
},
|
||||
success: function (result) {
|
||||
if (result) {
|
||||
var existing_ip = $('#pms_ip').val();
|
||||
|
@ -557,11 +553,12 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
function OAuthPreFunction() {
|
||||
$("#pms_token").val('');
|
||||
$("#pms-token-status").html('<i class="fa fa-refresh fa-spin"></i> Waiting for authentication...').fadeIn('fast');
|
||||
}
|
||||
function OAuthSuccessCallback(authToken) {
|
||||
$("#pms_token").val(authToken);
|
||||
$.post('save_pms_token', { token: authToken }, function () {
|
||||
$("#pms_token_validated").val(1);
|
||||
});
|
||||
$("#pms-token-status").html('<i class="fa fa-check"></i> Authentication successful.').fadeIn('fast');
|
||||
authenticated = true;
|
||||
getServerOptions(authToken);
|
||||
|
|
|
@ -214,7 +214,6 @@ class WebInterface(object):
|
|||
"pms_is_remote": plexpy.CONFIG.PMS_IS_REMOTE,
|
||||
"pms_ssl": plexpy.CONFIG.PMS_SSL,
|
||||
"pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD,
|
||||
"pms_token": plexpy.CONFIG.PMS_TOKEN,
|
||||
"pms_name": plexpy.CONFIG.PMS_NAME,
|
||||
"logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL
|
||||
}
|
||||
|
@ -226,11 +225,19 @@ class WebInterface(object):
|
|||
else:
|
||||
return serve_template(templatename="welcome.html", title="Welcome", config=config)
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def save_pms_token(self, token=None, **kwargs):
|
||||
if token is not None:
|
||||
plexpy.CONFIG.PMS_TOKEN = token
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi("get_server_list")
|
||||
def discover(self, token=None, include_cloud=True, all_servers=True, **kwargs):
|
||||
def discover(self, include_cloud=True, all_servers=True, **kwargs):
|
||||
""" Get all your servers that are published to Plex.tv.
|
||||
|
||||
```
|
||||
|
@ -255,11 +262,6 @@ class WebInterface(object):
|
|||
]
|
||||
```
|
||||
"""
|
||||
if token:
|
||||
# Need to set token so result doesn't return http 401
|
||||
plexpy.CONFIG.__setattr__('PMS_TOKEN', token)
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
include_cloud = not (include_cloud == 'false')
|
||||
all_servers = not (all_servers == 'false')
|
||||
|
||||
|
@ -3182,7 +3184,6 @@ class WebInterface(object):
|
|||
"pms_ip": plexpy.CONFIG.PMS_IP,
|
||||
"pms_logs_folder": plexpy.CONFIG.PMS_LOGS_FOLDER,
|
||||
"pms_port": plexpy.CONFIG.PMS_PORT,
|
||||
"pms_token": plexpy.CONFIG.PMS_TOKEN,
|
||||
"pms_ssl": plexpy.CONFIG.PMS_SSL,
|
||||
"pms_is_remote": plexpy.CONFIG.PMS_IS_REMOTE,
|
||||
"pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue