feature/40-pw_reset #48

Merged
niggl merged 17 commits from feature/40-pw_reset into dev 2020-12-22 15:29:45 +00:00
Showing only changes of commit 6042089074 - Show all commits

View File

@ -33,6 +33,20 @@ export class JwtCreator {
exp: expiry_timestamp
}, config.jwt_secret)
}
/**
* Creates a new password reset token for a given user.
* The token is valid for 15 minutes or 1 use - whatever comes first.
* @param user User entity that the password reset token shall be created for
*/
public static createReset(user: User) {
let expiry_timestamp = Math.floor(Date.now() / 1000) + 10 * 36000;
return jsonwebtoken.sign({
id: user.id,
refreshTokenCount: user.refreshTokenCount,
exp: expiry_timestamp
}, config.jwt_secret)
}
}
/**