mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #827 from sharelatex/pr-fix-account-deletion
Explicitly set the user default email for account deletion
This commit is contained in:
commit
4becf62fad
2 changed files with 17 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.controller "AccountSettingsController", ["$scope", "$http", "$modal", "event_tracking", ($scope, $http, $modal, event_tracking) ->
|
||||
App.controller "AccountSettingsController", ["$scope", "$http", "$modal", "event_tracking", "UserAffiliationsDataService", ($scope, $http, $modal, event_tracking, UserAffiliationsDataService) ->
|
||||
$scope.subscribed = true
|
||||
|
||||
$scope.unsubscribe = () ->
|
||||
|
@ -21,8 +21,14 @@ define [
|
|||
$scope.deleteAccount = () ->
|
||||
modalInstance = $modal.open(
|
||||
templateUrl: "deleteAccountModalTemplate"
|
||||
controller: "DeleteAccountModalController",
|
||||
scope: $scope
|
||||
controller: "DeleteAccountModalController"
|
||||
resolve:
|
||||
userDefaultEmail: () ->
|
||||
UserAffiliationsDataService
|
||||
.getUserDefaultEmail()
|
||||
.then (defaultEmailDetails) ->
|
||||
return defaultEmailDetails?.email or null
|
||||
.catch () -> null
|
||||
)
|
||||
|
||||
$scope.upgradeIntegration = (service) ->
|
||||
|
@ -30,8 +36,8 @@ define [
|
|||
]
|
||||
|
||||
App.controller "DeleteAccountModalController", [
|
||||
"$scope", "$modalInstance", "$timeout", "$http",
|
||||
($scope, $modalInstance, $timeout, $http) ->
|
||||
"$scope", "$modalInstance", "$timeout", "$http", "userDefaultEmail",
|
||||
($scope, $modalInstance, $timeout, $http, userDefaultEmail) ->
|
||||
$scope.state =
|
||||
isValid : false
|
||||
deleteText: ""
|
||||
|
@ -46,7 +52,7 @@ define [
|
|||
, 700
|
||||
|
||||
$scope.checkValidation = ->
|
||||
$scope.state.isValid = $scope.state.deleteText == $scope.email and $scope.state.password.length > 0
|
||||
$scope.state.isValid = userDefaultEmail? and $scope.state.deleteText == userDefaultEmail and $scope.state.password.length > 0
|
||||
|
||||
$scope.delete = () ->
|
||||
$scope.state.inflight = true
|
||||
|
|
|
@ -31,6 +31,10 @@ define [
|
|||
$http.get "/user/emails"
|
||||
.then (response) -> response.data
|
||||
|
||||
getUserDefaultEmail = () ->
|
||||
getUserEmails().then (userEmails) ->
|
||||
_.find userEmails, (userEmail) -> userEmail.default
|
||||
|
||||
getUniversitiesFromCountry = (country) ->
|
||||
if universities[country.code]?
|
||||
universitiesFromCountry = universities[country.code]
|
||||
|
@ -118,6 +122,7 @@ define [
|
|||
getDefaultRoleHints
|
||||
getDefaultDepartmentHints
|
||||
getUserEmails
|
||||
getUserDefaultEmail
|
||||
getUniversitiesFromCountry
|
||||
getUniversityDomainFromPartialDomainInput
|
||||
getUniversityDetails
|
||||
|
|
Loading…
Reference in a new issue