mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-23 23:11:13 -04:00
Autofix on save
This commit is contained in:
parent
8331e795e7
commit
9648d700d7
29 changed files with 1182 additions and 1089 deletions
|
@ -1,6 +1,6 @@
|
|||
const basicAuth = require('express-basic-auth')
|
||||
const passwordHash = require('./password-hash');
|
||||
const {R} = require("redbean-node");
|
||||
const basicAuth = require("express-basic-auth")
|
||||
const passwordHash = require("./password-hash");
|
||||
const { R } = require("redbean-node");
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -10,7 +10,7 @@ const {R} = require("redbean-node");
|
|||
*/
|
||||
exports.login = async function (username, password) {
|
||||
let user = await R.findOne("user", " username = ? AND active = 1 ", [
|
||||
username
|
||||
username,
|
||||
])
|
||||
|
||||
if (user && passwordHash.verify(password, user.password)) {
|
||||
|
@ -18,13 +18,13 @@ exports.login = async function (username, password) {
|
|||
if (passwordHash.needRehash(user.password)) {
|
||||
await R.exec("UPDATE `user` SET password = ? WHERE id = ? ", [
|
||||
passwordHash.generate(password),
|
||||
user.id
|
||||
user.id,
|
||||
]);
|
||||
}
|
||||
return user;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function myAuthorizer(username, password, callback) {
|
||||
|
@ -36,5 +36,5 @@ function myAuthorizer(username, password, callback) {
|
|||
exports.basicAuth = basicAuth({
|
||||
authorizer: myAuthorizer,
|
||||
authorizeAsync: true,
|
||||
challenge: true
|
||||
challenge: true,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue