Skip to content

Commit

Permalink
Remove login requirement
Browse files Browse the repository at this point in the history
Fix #17
  • Loading branch information
unhammer committed Jun 12, 2023
1 parent 78622b7 commit a9c4ef7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 10 additions & 2 deletions lib/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ $(document).ready(function() {
}
});

const requireLogin = false;

var hideLogin = function () {
$("#serverfault").hide();
$("#loginform").hide();
Expand All @@ -416,8 +418,11 @@ var hideLogin = function () {
$("#logout").show();
};

var showLogin = function () {
// caller decides whether to show #serverfault
var showLogin = function showLogin() {
if(!requireLogin) {
hideLogin();
return;
}
$("#loginform").show();
$("#content").addClass("blur");
$("#login-wrapper").addClass("block-view");
Expand Down Expand Up @@ -484,7 +489,9 @@ var servercheck = function(userpass/*:userpass*/,
console.log(url, data);
return $.ajax(url, {
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", basicAuthHeader(userpass));
if(requireLogin) {
xhr.setRequestHeader("Authorization", basicAuthHeader(userpass));
}
},
type: "POST",
data: data,
Expand Down Expand Up @@ -753,7 +760,7 @@ var check = function() {

let userpass = safeGetItem("userpass",
readLoginFormStoring());
if(userpass == null) {
if (requireLogin && userpass == null) {
showLogin();
}
else {
Expand Down

0 comments on commit a9c4ef7

Please sign in to comment.