3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Dashboard work. Move configs to DB. Some script reorganization. Add nodemon configs.

This commit is contained in:
Dragory 2019-06-22 18:52:24 +03:00
parent 168d82a966
commit 2adc5af8d7
39 changed files with 8441 additions and 2915 deletions

View file

@ -32,7 +32,7 @@ export class DashboardLogins extends BaseRepository {
const login = await this.dashboardLogins
.createQueryBuilder()
.where("id = :id", { id: loginId })
.where("expires_at > NOW()")
.andWhere("expires_at > NOW()")
.getOne();
if (!login) {
@ -40,7 +40,7 @@ export class DashboardLogins extends BaseRepository {
}
const hash = crypto.createHash("sha256");
hash.update(token);
hash.update(loginId + token); // Remember to use loginId as the salt
const hashedToken = hash.digest("hex");
if (hashedToken !== login.token) {
return null;
@ -65,7 +65,7 @@ export class DashboardLogins extends BaseRepository {
// Generate token
const token = uuidv4();
const hash = crypto.createHash("sha256");
hash.update(token);
hash.update(loginId + token); // Use loginId as a salt
const hashedToken = hash.digest("hex");
// Save this to the DB