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) {
$.notify(locale.ERROR_OCCURRED, 'error');
},
success: function(data) {
$('#authPass').val('');
if (data.status == 'success'){
$('#ownerAuthModal').modal('hide');
getRoomInfo();
$.notify(data.msg, 'success');
data = data.responseJSON;
if (data.msg){
$.notify(data.msg, 'error');
}
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(
json => {
msg => $self->l('ERROR_OCCURRED'),
err => 'ERROR_OCCURRED',
status => 'error'
}
},
status => 503
);
}
# Add or remove an email address to the list of email notifications
@ -1559,8 +1561,10 @@ any '/api' => sub {
return $self->render(
json => {
msg => $self->l('ERROR_MAIL_INVALID'),
err => 'ERROR_MAIL_INVALID',
status => 'error'
}
},
status => 400
);
}
elsif ($set eq 'on' && $self->add_notification($room->{name},$email)){
@ -1582,8 +1586,10 @@ any '/api' => sub {
return $self->render(
json => {
msg => $self->l('ERROR_OCCURRED'),
err => 'ERROR_OCCURRED',
status => 'error'
}
},
status => 503
);
}
elsif ($req->{action} eq 'authenticate'){
@ -1608,16 +1614,20 @@ any '/api' => sub {
return $self->render(
json => {
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
return $self->render(
json => {
msg => $self->l('NOT_ALLOWED'),
err => 'NOT_ALLOWED',
status => 'error'
}
},
status => 403
);
}
# Return just room config

Loading…
Cancel
Save