Skip to content
Snippets Groups Projects
Commit e1a95f91 authored by Tom Käsler's avatar Tom Käsler
Browse files

Allow direct entry for participants

Login the user as guest if he enters the participant room page
parent e0a1d3e2
1 merge request!360Improve roles and authentication
import { Component, OnInit } from '@angular/core';
import { Room } from '../../../models/room';
import { User } from '../../../models/user';
import { UserRole } from '../../../models/user-roles.enum';
import { RoomPageComponent } from '../../shared/room-page/room-page.component';
import { Location } from '@angular/common';
import { RoomService } from '../../../services/http/room.service';
......@@ -8,6 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service';
import { WsCommentServiceService } from '../../../services/websockets/ws-comment-service.service';
import { CommentService } from '../../../services/http/comment.service';
import { AuthenticationService } from '../../../services/http/authentication.service';
@Component({
selector: 'app-room-participant-page',
......@@ -19,6 +22,7 @@ export class RoomParticipantPageComponent extends RoomPageComponent implements O
room: Room;
isLoading = true;
deviceType = localStorage.getItem('deviceType');
user: User;
constructor(protected location: Location,
......@@ -27,7 +31,8 @@ export class RoomParticipantPageComponent extends RoomPageComponent implements O
private translateService: TranslateService,
protected langService: LanguageService,
protected wsCommentService: WsCommentServiceService,
protected commentService: CommentService) {
protected commentService: CommentService,
private authenticationService: AuthenticationService) {
super(roomService, route, location, wsCommentService, commentService);
langService.langEmitter.subscribe(lang => translateService.use(lang));
}
......@@ -38,5 +43,9 @@ export class RoomParticipantPageComponent extends RoomPageComponent implements O
this.initializeRoom(params['roomId']);
});
this.translateService.use(localStorage.getItem('currentLang'));
this.authenticationService.watchUser.subscribe( user => this.user = user);
if (!this.user) {
this.authenticationService.guestLogin(UserRole.PARTICIPANT).subscribe(guestUser => {});
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment