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:
@@ -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 {}
|
||||
|
@@ -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>
|
||||
|
@@ -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,
|
||||
|
||||
|
Reference in New Issue
Block a user