1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Switch to sending plaintext password and remove Hashing code

This commit is contained in:
Neil Burrows 2020-11-08 12:32:35 +00:00
parent 536effbc1a
commit adb9f209bb

View file

@ -83,13 +83,6 @@ export default function (page, providerId, options) {
loading.hide(); loading.hide();
} }
function sha1(str) {
const buffer = new TextEncoder('utf-8').encode(str);
return crypto.subtle.digest('SHA-1', buffer).then(function (hash) {
return hex(hash);
});
}
function hex(buffer) { function hex(buffer) {
const hexCodes = []; const hexCodes = [];
const view = new DataView(buffer); const view = new DataView(buffer);
@ -106,35 +99,33 @@ export default function (page, providerId, options) {
function submitLoginForm() { function submitLoginForm() {
loading.show(); loading.show();
sha1(page.querySelector('.txtPass').value).then(function (passwordHash) { const info = {
const info = { Type: 'SchedulesDirect',
Type: 'SchedulesDirect', Username: page.querySelector('.txtUser').value,
Username: page.querySelector('.txtUser').value, EnableAllTuners: true,
EnableAllTuners: true, Password: page.querySelector('.txtPass').value
Password: passwordHash };
}; const id = providerId;
const id = providerId;
if (id) { if (id) {
info.Id = id; info.Id = id;
} }
ApiClient.ajax({ ApiClient.ajax({
type: 'POST', type: 'POST',
url: ApiClient.getUrl('LiveTv/ListingProviders', { url: ApiClient.getUrl('LiveTv/ListingProviders', {
ValidateLogin: true ValidateLogin: true
}), }),
data: JSON.stringify(info), data: JSON.stringify(info),
contentType: 'application/json', contentType: 'application/json',
dataType: 'json' dataType: 'json'
}).then(function (result) { }).then(function (result) {
Dashboard.processServerConfigurationUpdateResult(); Dashboard.processServerConfigurationUpdateResult();
providerId = result.Id; providerId = result.Id;
reload(); reload();
}, function () { }, function () {
Dashboard.alert({ // ApiClient.ajax() error handler Dashboard.alert({ // ApiClient.ajax() error handler
message: globalize.translate('ErrorSavingTvProvider') message: globalize.translate('ErrorSavingTvProvider')
});
}); });
}); });
} }