Fixes in authenticate methode

master
Daniel Berteaud 9 years ago
parent 190f28ab11
commit c8d6bde2de
  1. 13
      vroom.pl

@ -1461,10 +1461,9 @@ any '/api' => sub {
return $self->render(json => $json, status => 500); return $self->render(json => $json, status => 500);
} }
$json->{err} = ''; $json->{err} = '';
$self->session($req->{param}->{room} => {role => 'owner'});
$self->associate_key_to_room( $self->associate_key_to_room(
room => $req->{param}->{room}, room => $req->{param}->{room},
key => $self->session('key'), key => $token,
role => 'owner' role => 'owner'
); );
return $self->render(json => $json); return $self->render(json => $json);
@ -1507,20 +1506,24 @@ any '/api' => sub {
$role = 'participant'; $role = 'participant';
} }
if ($role){ if ($role){
$self->session($room->{name}, {role => $role}); if (!$self->session($room->{name})){
$self->session($room->{name} => {});
}
if ($ec && !$self->session($room->{name})->{etherpadSession}){ if ($ec && !$self->session($room->{name})->{etherpadSession}){
$self->create_etherpad_session($room->{name}); $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( $self->associate_key_to_room(
room => $room->{name}, room => $room->{name},
key => $self->session('key'), key => $token,
role => $role role => $role
); );
return $self->render( return $self->render(
json => { json => {
msg => $self->l('AUTH_SUCCESS'), msg => $self->l('AUTH_SUCCESS'),
role => $role, role => $role,
peer_id => $self->session('peer_id')
} }
); );
} }

Loading…
Cancel
Save