1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 21:29:42 +02:00

account deactivation process

This commit is contained in:
Harvey Kandola 2018-11-09 13:42:58 +00:00
parent 6a9ad7f540
commit 0a64afd6b5
5 changed files with 66 additions and 2 deletions

View file

@ -21,6 +21,8 @@ package backup
// the file is deleted at the end of the process.
//
// The backup file contains a manifest file that describes the backup.
//
// TODO: explore writing straight to HTTP response via https://github.com/mholt/archiver
import (
"archive/zip"

View file

@ -12,9 +12,10 @@
import { empty } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Notifier from '../../mixins/notifier';
import Modals from '../../mixins/modal';
import Component from '@ember/component';
export default Component.extend(Notifier, {
export default Component.extend(Notifier, Modals, {
appMeta: service(),
global: service(),
licenseError: empty('license'),
@ -44,6 +45,13 @@ export default Component.extend(Notifier, {
this.showDone();
window.location.reload();
});
},
onDeactivate() {
this.get('global').deactivate().then(() => {
this.showDone();
this.modalOpen("#deactivation-modal", {"show": true});
});
}
}
});

View file

@ -234,5 +234,15 @@ export default Service.extend({
xhr.send(data);
});
}
},
deactivate() {
if(this.get('sessionService.isAdmin')) {
return this.get('ajax').request(`deactivate`, {
method: 'POST',
}).then(() => {
return;
});
}
},
});

View file

@ -222,4 +222,13 @@
}
}
}
> .deactivation-zone {
@include border-radius(3px);
border: 1px solid $color-red;
margin: 30px 0;
padding: 20px 20px;
background-color: lighten($color-red, 60%);
color: $color-off-black;
}
}

View file

@ -130,3 +130,38 @@
{{/if}}
</form>
</div>
{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
{{#if (eq appMeta.location 'cloud')}}
<div class="row">
<div class="col-sm-4"></div>
<div class="col-sm-7">
<div class="view-customize">
<div class="deactivation-zone">
<p>Let us know if you would like to close your account or cancel your subscription.</p>
<p><span class="font-weight-bold">WARNING: </span>All data will be deleted so please download a complete backup of all your data.</p>
<p>Requests can take up to 24 hours to process.</p>
{{#link-to 'customize.backup' class="btn btn-success"}}PERFORM BACKUP{{/link-to}}
<div class="button-gap" />
<button class="btn btn-danger" {{action 'onDeactivate'}}>REQUEST ACCOUNT CLOSURE</button>
</div>
</div>
</div>
</div>
{{/if}}
{{/if}}
<div id="deactivation-modal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">Deactivation Requested</div>
<div class="modal-body">
<p>Your request has been sent and will be processed shortly.</p>
<p>If you haven't already, perform a backup to download all your data.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>