Added contact to login, added some auth exceptions

This commit is contained in:
MrFry 2020-04-08 19:24:17 +02:00
parent 143894288a
commit a6d260f6af
6 changed files with 26 additions and 6 deletions

View file

@ -22,7 +22,7 @@ module.exports = function (options) {
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
const sessionID = req.cookies.sessionID const sessionID = req.cookies.sessionID
const isException = exceptions.some((exc) => { const isException = exceptions.some((exc) => {
return req.url === exc return req.url.split('?')[0] === exc
}) })
// TODO Allowing all urls with _next in it, but not in params // TODO Allowing all urls with _next in it, but not in params

View file

@ -72,7 +72,11 @@ function GetApp () {
exceptions: [ exceptions: [
'/favicon.ico', '/favicon.ico',
'/login', '/login',
'/getveteranpw' '/getveteranpw',
'/postfeedbackfile',
'/postfeedback',
'/fosuploader',
'/badtestsender'
] ]
})) }))
app.use(express.static('public')) app.use(express.static('public'))
@ -575,6 +579,7 @@ function GetApp () {
} }
function IncrementAvaiblePWs () { function IncrementAvaiblePWs () {
// FIXME: check this if this is legit and works
const users = dbtools.SelectAll(userDB, 'users') const users = dbtools.SelectAll(userDB, 'users')
const today = new Date() const today = new Date()
const getDayDiff = (dateString) => { const getDayDiff = (dateString) => {
@ -593,6 +598,7 @@ function GetApp () {
} }
if (dayDiff % addPWPerDay === 0) { if (dayDiff % addPWPerDay === 0) {
logger.Log(`Incrementing avaible PW-s for user #${u.id}`, logger.GetColor('cyan'))
dbtools.Update(userDB, 'users', { dbtools.Update(userDB, 'users', {
avaiblePWRequests: u.avaiblePWRequests + 1 avaiblePWRequests: u.avaiblePWRequests + 1
}, { }, {

@ -1 +1 @@
Subproject commit 0ba12f4d67f2bfb5ba2553f32dec5a2b439960fb Subproject commit 179aa6ebfab2a85c59a251d7bf08988076a51732

@ -1 +1 @@
Subproject commit 9f576a41f6a8b1de82f2a0cf901046a76ff9a1ed Subproject commit 42e6d4dd4c86541bc02787a1df3e22ba8f781295

View file

@ -54,7 +54,10 @@ function GetApp () {
jsonResponse: false, jsonResponse: false,
exceptions: [ exceptions: [
'/favicon.ico', '/favicon.ico',
'/getVeteranPw' '/getVeteranPw',
'/moodle-test-userscript/stable.user.js',
'/donate',
'/irc'
] ]
})) }))
app.use(express.static('modules/qmining/public')) app.use(express.static('modules/qmining/public'))
@ -82,7 +85,7 @@ function GetApp () {
}, },
{ {
from: '/install', from: '/install',
to: 'https://greasyfork.org/en/scripts/38999-moodle-elearning-kmooc-test-help' to: 'https://qmining.frylabs.net/moodle-test-userscript/stable.user.js'
}, },
{ {
from: '/servergit', from: '/servergit',

View file

@ -62,6 +62,14 @@
margin: 4px 2px; margin: 4px 2px;
cursor: pointer; cursor: pointer;
} }
.ircLinkContainer {
display: flex;
justify-content: flex-end
}
.ircLink {
color: #9999ff;
font-size: 12px;
}
</style> </style>
</head> </head>
<div class='center'> <div class='center'>
@ -77,6 +85,9 @@
👁 👁
</span> --> </span> -->
</div> </div>
<div class='ircLinkContainer' >
<a class='ircLink' href='https://qmining.frylabs.net/irc?loginClick'>Contact</a>
</div>
<button id='sendButton' onclick="Login(this)">Submit</button> <button id='sendButton' onclick="Login(this)">Submit</button>
</div> </div>
</div> </div>