Skip to content

Commit

Permalink
hotfix login with token
Browse files Browse the repository at this point in the history
  • Loading branch information
heliomarpm committed Dec 18, 2021
1 parent f07d9d2 commit de037d0
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Version 1.10.1

* Hotfix - Login with access token
* Removed obsolete option, Authenticator

## Version 1.10.0

* Option for open downloading folder
* New option config - Number download with zero left.
* Auto ignore attachments downloaded
Expand Down
29 changes: 26 additions & 3 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ function loginWithUdemy() {
session.defaultSession.clearStorageData();
session.defaultSession.webRequest.onBeforeSendHeaders(
{ urls: ["*://*.udemy.com/*"] },
function (request, callback) {
function (request, callback) {
callback({ requestHeaders: request.requestHeaders });
}
);
Expand Down Expand Up @@ -1698,19 +1698,42 @@ function checkLogin() {
}
}


function loginWithPassword() {
if ($(".ui.login .form").find('input[name="business"]').is(":checked")) {
if (!$subDomain.val()) {
prompt.alert("Type Business Name");
return;
}
} else {
$subDomain.val("www");
}


// prompt.prompt("Access Token", function (access_token) {
// if (access_token) {
// const submain = $subDomain.val();
// settings.set("access_token", access_token);
// settings.set("subdomain", submain.length == 0 ? "www" : submain);
// checkLogin();
// }
// });
}

function loginWithAccessToken() {
if ($(".ui.login .form").find('input[name="business"]').is(":checked")) {
if (!$subDomain.val()) {
prompt.alert("Type Business Name");
return;
}
} else {
$subDomain.val(null);
$subDomain.val("www");
}
prompt.prompt("Access Token", function (access_token) {
if (access_token) {
const submain = $subDomain.val();
settings.set("access_token", access_token);
settings.set("subdomain", $subDomain.val() ?? "www");
settings.set("subdomain", submain.length == 0 ? "www" : submain);
checkLogin();
}
});
Expand Down
31 changes: 23 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ <h2 class="ui icon grey login header">
<div class="row">
<div class="ten wide column">
<form class="ui form">
<!-- <div class="field">
<div class="ui fluid label input">
<input type="text" name="username" id="username" placeholder="${translate("Username")}">
<input type="password" name="userpass" id="userpass" placeholder="${translate("Password")}">
</div>
</div> -->
<div class="field">
<div class="ui fluid label checkbox">
<input type="checkbox" name="business" id="business">
Expand All @@ -119,22 +126,30 @@ <h2 class="ui icon grey login header">
<div class="ui horizontal divider">
${translate("Choose Login Method")}
</div>
<button class="ui fluid purple button" type="button" onclick="loginWithUdemy()">
${translate("Login Using Credentials")}
</button>
<div class="ui fluid icon buttons">
<!-- <button class="ui purple button" onclick="loginWithPassword()" style="margin-right: 1px">
<i class="key icon"></i> ${translate("Using Password")}
</button>
<div class="or"></div> -->
<button class="ui purple button" type="button" onclick="loginWithUdemy()">
${translate("Get Credentials")}
</button>
</div>
<div class="ui horizontal divider">
<i class="exchange icon"></i>
</div>
<div class="ui fluid icon buttons">
<!-- <div class="ui fluid icon buttons">
<button class="ui blue login disabled authenticator button" style="margin-right: 1px">
<i class="user secret icon"></i> Authenticator
</button>
<div class="or"></div>
<button class="ui violet button" onclick="loginWithAccessToken()" style="margin-left: 1px">
<div class="or"></div> -->
<button class="ui fluid violet button" onclick="loginWithAccessToken()" style="margin-left: 1px">
<i class="key icon"></i> Access Token
</button>
</div>
</div>
<!-- </div> -->
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion locale/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,7 @@
"Collaborate": "Colaborar",
"Confirm Log Out?": "Deseja desconectar?",
"Number downloads with zero left": "Numerar downloads com zero à esquerda",
"Old version": "Versão antiga"
"Old version": "Versão antiga",
"Using Password": "Use a senha",
"Get Credentials": "Obter credenciais"
}
4 changes: 3 additions & 1 deletion locale/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,7 @@
"Collaborate": "",
"Confirm Log Out?": "",
"Number downloads with zero left": "",
"Old version": ""
"Old version": "",
"Using Password": "",
"Get Credentials": ""
}

0 comments on commit de037d0

Please sign in to comment.