add functions to login the radar scope
This commit is contained in:
@@ -113,6 +113,15 @@ export class AuthService {
|
||||
});
|
||||
}
|
||||
|
||||
async loginRadarScope(vatsimId: string, key: string): Promise<string> {
|
||||
return this.userModel.findOne({ vatsimId }).then((user) => {
|
||||
if (!user || user.radarScopeKey !== key) return undefined;
|
||||
|
||||
const payload = { vatsimId: vatsimId, sub: key };
|
||||
return this.jwtService.sign(payload);
|
||||
});
|
||||
}
|
||||
|
||||
async resetRadarScopeKey(token: string): Promise<void> {
|
||||
const payload = this.jwtService.verify(token, {
|
||||
secret: this.config.get<string>('server.jwt-secret'),
|
||||
|
||||
Reference in New Issue
Block a user