latest work #20

Merged
philipp merged 233 commits from dev into main 2020-12-09 18:49:33 +00:00
Showing only changes of commit a0fe8c0017 - Show all commits

View File

@ -33,20 +33,20 @@ export class CreateAuth {
} else {
const found_user = found_users[0]
if (await argon2.verify(found_user.password, this.password + found_user.uuid)) {
// TODO: proper jwt creation
const timestamp_accesstoken_expiry = Math.floor(Date.now() / 1000) + 5 * 60
delete found_user.password;
newAuth.access_token = jsonwebtoken.sign({
refreshtokencount: 5,
userdetails: {},
userdetails: found_user,
exp: timestamp_accesstoken_expiry
}, "securekey")
newAuth.access_token_expires_at = timestamp_accesstoken_expiry
//
const timestamp_refresh_expiry = Math.floor(Date.now() / 1000) + 10 * 36000
newAuth.refresh_token = jsonwebtoken.sign({
refreshtokencount: 5,
userdetails: {},
userid: found_user.id,
exp: timestamp_refresh_expiry
}, "securekey")
newAuth.access_token_expires_at = timestamp_accesstoken_expiry
newAuth.refresh_token_expires_at = timestamp_refresh_expiry
} else {
throw new InvalidCredentialsError()