More HTTP codes fixes

master
Daniel Berteaud 10 years ago
parent 90267dd2e9
commit 34cf709893
  1. 19
      public/js/vroom.js
  2. 22
      vroom.pl

@ -1836,18 +1836,19 @@ function initVroom(room) {
}) })
}, },
error: function(data) { error: function(data) {
$.notify(locale.ERROR_OCCURRED, 'error'); data = data.responseJSON;
}, if (data.msg){
success: function(data) { $.notify(data.msg, 'error');
$('#authPass').val('');
if (data.status == 'success'){
$('#ownerAuthModal').modal('hide');
getRoomInfo();
$.notify(data.msg, 'success');
} }
else{ else{
$.notify(data.msg, 'error'); $.notify(locale.ERROR_OCCURRED, 'error');
} }
},
success: function(data) {
$('#authPass').val('');
$('#ownerAuthModal').modal('hide');
getRoomInfo();
$.notify(data.msg, 'success');
} }
}); });
}); });

@ -1547,8 +1547,10 @@ any '/api' => sub {
return $self->render( return $self->render(
json => { json => {
msg => $self->l('ERROR_OCCURRED'), msg => $self->l('ERROR_OCCURRED'),
err => 'ERROR_OCCURRED',
status => 'error' status => 'error'
} },
status => 503
); );
} }
# Add or remove an email address to the list of email notifications # Add or remove an email address to the list of email notifications
@ -1559,8 +1561,10 @@ any '/api' => sub {
return $self->render( return $self->render(
json => { json => {
msg => $self->l('ERROR_MAIL_INVALID'), msg => $self->l('ERROR_MAIL_INVALID'),
err => 'ERROR_MAIL_INVALID',
status => 'error' status => 'error'
} },
status => 400
); );
} }
elsif ($set eq 'on' && $self->add_notification($room->{name},$email)){ elsif ($set eq 'on' && $self->add_notification($room->{name},$email)){
@ -1582,8 +1586,10 @@ any '/api' => sub {
return $self->render( return $self->render(
json => { json => {
msg => $self->l('ERROR_OCCURRED'), msg => $self->l('ERROR_OCCURRED'),
err => 'ERROR_OCCURRED',
status => 'error' status => 'error'
} },
status => 503
); );
} }
elsif ($req->{action} eq 'authenticate'){ elsif ($req->{action} eq 'authenticate'){
@ -1608,16 +1614,20 @@ any '/api' => sub {
return $self->render( return $self->render(
json => { json => {
status => 'error', status => 'error',
msg => $self->l('WRONG_PASSWORD') msg => $self->l('WRONG_PASSWORD'),
} err => 'WRONG_PASSWORD'
},
status => 401
); );
} }
# There's no owner password, so you cannot auth # There's no owner password, so you cannot auth
return $self->render( return $self->render(
json => { json => {
msg => $self->l('NOT_ALLOWED'), msg => $self->l('NOT_ALLOWED'),
err => 'NOT_ALLOWED',
status => 'error' status => 'error'
} },
status => 403
); );
} }
# Return just room config # Return just room config

Loading…
Cancel
Save