forked from Archives/Athou_commafeed
allow users to permanently delete their account
This commit is contained in:
@@ -809,8 +809,8 @@ function($scope, $location, SettingsService, AnalyticsService) {
|
||||
};
|
||||
}]);
|
||||
|
||||
module.controller('ProfileCtrl', ['$scope', '$location', 'ProfileService', 'AnalyticsService',
|
||||
function($scope, $location, ProfileService, AnalyticsService) {
|
||||
module.controller('ProfileCtrl', ['$scope', '$location', '$dialog', 'ProfileService', 'AnalyticsService',
|
||||
function($scope, $location, $dialog, ProfileService, AnalyticsService) {
|
||||
|
||||
AnalyticsService.track();
|
||||
|
||||
@@ -832,7 +832,25 @@ function($scope, $location, ProfileService, AnalyticsService) {
|
||||
ProfileService.save(o, function() {
|
||||
$location.path('/');
|
||||
});
|
||||
};
|
||||
$scope.deleteAccount = function() {
|
||||
var title = 'Delete account';
|
||||
var msg = 'Delete your acount? There\'s no turning back!';
|
||||
var btns = [ {
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'OK',
|
||||
cssClass : 'btn-primary'
|
||||
} ];
|
||||
|
||||
$dialog.messageBox(title, msg, btns).open().then(function(result) {
|
||||
if (result == 'ok') {
|
||||
ProfileService.deleteAccount();
|
||||
window.location.href = 'logout';
|
||||
}
|
||||
});
|
||||
};
|
||||
}]);
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ module.service('AnalyticsService', [ '$state', function($state) {
|
||||
|
||||
|
||||
module.factory('ProfileService', ['$resource', function($resource) {
|
||||
return $resource('rest/user/profile/');
|
||||
var res = $resource('rest/user/profile/');
|
||||
res.deleteAccount = $resource('rest/user/profile/deleteAccount').save;
|
||||
return res;
|
||||
}]);
|
||||
|
||||
module.factory('SettingsService', ['$resource', function($resource) {
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
<button type="button" class="btn" ng-click="cancel()">Cancel</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="deleteAccount()">Delete account</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user