From c8d6bde2de827935fd88e5f71a146a8df543ea6e Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Sat, 27 Jun 2015 14:06:01 +0200 Subject: [PATCH] Fixes in authenticate methode --- vroom.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/vroom.pl b/vroom.pl index aae32de..1b737be 100755 --- a/vroom.pl +++ b/vroom.pl @@ -1461,10 +1461,9 @@ any '/api' => sub { return $self->render(json => $json, status => 500); } $json->{err} = ''; - $self->session($req->{param}->{room} => {role => 'owner'}); $self->associate_key_to_room( room => $req->{param}->{room}, - key => $self->session('key'), + key => $token, role => 'owner' ); return $self->render(json => $json); @@ -1507,20 +1506,24 @@ any '/api' => sub { $role = 'participant'; } if ($role){ - $self->session($room->{name}, {role => $role}); + if (!$self->session($room->{name})){ + $self->session($room->{name} => {}); + } if ($ec && !$self->session($room->{name})->{etherpadSession}){ $self->create_etherpad_session($room->{name}); } + if ($self->session('peer_id')){ + $self->set_peer_role({ peer_id => $self->session('peer_id'), role => $role }); + } $self->associate_key_to_room( room => $room->{name}, - key => $self->session('key'), + key => $token, role => $role ); return $self->render( json => { msg => $self->l('AUTH_SUCCESS'), role => $role, - peer_id => $self->session('peer_id') } ); }