1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 00:00:00 +00:00

update device remote wipe

This commit is contained in:
lian
2016-05-27 10:04:27 +08:00
parent 7dc7034de4
commit 2258067cd8
3 changed files with 15 additions and 23 deletions

View File

@@ -4545,13 +4545,16 @@ class RemoteWipeReportView(APIView):
@json_response
def post(self, request):
from seahub.api2.models import WipedDevice
token = request.POST.get('token', '')
token = request.data.get('token', '')
if not token or len(token) != 40:
return api_error(status.HTTP_400_BAD_REQUEST, "device token is missing")
error_msg = 'token invalid.'
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
try:
entry = WipedDevice.objects.get(key=token)
entry.delete()
except WipedDevice.DoesNotExist:
return api_error(status.HTTP_400_BAD_REQUEST, "invalid device token")
error_msg = 'token %s not found.' % token
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
return {}

View File

@@ -234,3 +234,12 @@
<a href="{{ SITE_ROOT }}accounts/logout/" class="item" id="logout">{% trans "Log out" %}</a>
</div>
</script>
<script type="text/template" id="confirm-dialog-with-extra-option-tmpl">
<h3><%= title %></h3>
<p><%= content %></p>
<label class="checkbox-label">
<input type="checkbox" name="confirm-extra-option" id="confirm-extra-option" class="vam" />
<span class="checkbox-option vam"><%= extraOption %></span>
</label>
</script>

View File

@@ -49,25 +49,6 @@ define([
return this;
},
unlinkDevice: function() {
var _this = this,
device_name = this.model.get('device_name');
this.model.unlink({
success: function() {
_this.remove();
var msg = gettext("Successfully unlink %(name)s.")
.replace('%(name)s', Common.HTMLescape(device_name));
Common.feedback(msg, 'success');
},
error: function(xhr) {
Common.ajaxErrorHandler(xhr);
}
});
return false;
},
unlinkDeviceWithConfirm: function() {
var _this = this,
device_name = this.model.get('device_name');
@@ -76,7 +57,6 @@ define([
var extraOption = gettext('Delete files from this device the next time it comes online.');
var yesCallback = function (wipe_device) {
console.log('wipe_device = ' + wipe_device);
_this.model.unlink({
wipe_device: wipe_device,