Commit fcfaaf02 authored by gergely-ujvari's avatar gergely-ujvari Committed by Randall Leeds

Introduce disable_user

As a first step for user deletion we just deactivate the user.
In the backend the ProfileController class has a new method disable_user
which (if the correct password is given) deactivates the user

In the backend the session/profile factory has a disable_user action
with which the ProfileController can be reached.
parent 57d5365a
......@@ -111,6 +111,11 @@ profileProvider = [
params:
__formid__: "edit_profile"
withCredentials: true
disable_user:
method: 'POST'
params:
__formid__: "disable_user"
withCredentials: true
$resource("#{baseURI}app", {}, actions)
]
......
......@@ -374,11 +374,13 @@ match = ->
require: 'ngModel'
accountManagement = ['$filter', 'flash', 'profile', ($filter, flash, profile) ->
link: (scope, elem, attr, ctrl) ->
scope.emailCheck = ->
link: ($scope, elem, attr, ctrl) ->
$scope.emailCheck = ->
console.log 'scope.emailCheck'
# Checks to see if email is duplicate.
return
controller: ($scope, $filter) ->
controller: ($scope, $filter, $rootScope) ->
persona_filter = $filter('persona')
_answer = (response) ->
......@@ -403,14 +405,22 @@ accountManagement = ['$filter', 'flash', 'profile', ($filter, flash, profile) ->
# If the password is correct, the account is deleted.
# The extension is then removed from the page.
# Confirmation of success is given.
alert("Account deleted.")
return unless form.$valid
username = persona_filter $scope.session.persona
packet =
username: username
pwd: form.deleteaccountpassword.$modelValue
promise = profile.disable_user packet
promise.$promise.then(_answer, _error)
$scope.submit = (form) ->
# In the frontend change_email and change_password are two different
# forms. However, in the backend it is just one: edit_profile
return unless form.$valid
username = persona_filter $scope.model.persona
username = persona_filter $scope.session.persona
if form.$name is 'edit_profile'
packet =
username: username
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment