Removed auto-login because it was too buggy
This commit is contained in:
parent
eca50edb93
commit
52f3cd1f15
@ -1 +1 @@
|
||||
{"theme":"dark","user":"arne.v.iterson@hotmail.nl","password":""}
|
||||
{"theme":"light","user":"arne.v.iterson@hotmail.nl","password":""}
|
@ -18,6 +18,9 @@
|
||||
<button id="upload">Upload Skin</button><br>
|
||||
<button id="random">Random Skin</button><br>
|
||||
<button id="logout">Logout</button>
|
||||
<p class="message info">
|
||||
Logging out will delete your password from storage, if you want it to autofill next time you can just close this window when you are done.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script src="../src/main.js"></script>
|
||||
|
2
main.js
2
main.js
@ -42,10 +42,12 @@ require("electron-handlebars")({
|
||||
|
||||
// Respond to renderer requests
|
||||
ipcMain.on("getAuth", (event) => {
|
||||
authData = JSON.parse(fs.readFileSync("./data/data.json"));
|
||||
event.returnValue = authData;
|
||||
});
|
||||
|
||||
ipcMain.on("setAuth", (event, data) => {
|
||||
authData = JSON.parse(fs.readFileSync("./data/data.json"));
|
||||
if (data != authData) {
|
||||
fs.writeFileSync("./data/data.json", JSON.stringify(data));
|
||||
}
|
||||
|
28
src/auth.js
28
src/auth.js
@ -54,19 +54,19 @@ async function authenticate(user, password) {
|
||||
}
|
||||
|
||||
// Get access token from Mojang Authserver
|
||||
if (authData.password == "") {
|
||||
// Display auth screen when no password data is found
|
||||
const form = document.querySelectorAll("div.content > form")[0];
|
||||
form.querySelectorAll("input#user")[0].value = authData.user;
|
||||
const form = document.querySelectorAll("div.content > form")[0];
|
||||
form.querySelectorAll("input#user")[0].value = authData.user;
|
||||
form.querySelectorAll("input#password")[0].value = authData.password;
|
||||
|
||||
// Listen for form submit
|
||||
form.addEventListener("submit", function(e) {
|
||||
e.preventDefault();
|
||||
authData.user = form.querySelectorAll("input#user")[0].value;
|
||||
authData.password = form.querySelectorAll("input#password")[0].value;
|
||||
save = form.querySelectorAll("input#save")[0].checked;
|
||||
authenticate(authData.user, authData.password);
|
||||
});
|
||||
} else {
|
||||
authenticate(authData.user, authData.password);
|
||||
if (authData.password != "") {
|
||||
form.querySelectorAll("input#save")[0].checked = true;
|
||||
}
|
||||
|
||||
// Listen for form submit
|
||||
form.addEventListener("submit", function(e) {
|
||||
e.preventDefault();
|
||||
authData.user = form.querySelectorAll("input#user")[0].value;
|
||||
authData.password = form.querySelectorAll("input#password")[0].value;
|
||||
save = form.querySelectorAll("input#save")[0].checked;
|
||||
authenticate(authData.user, authData.password);
|
||||
});
|
Loading…
Reference in New Issue
Block a user