Add ability for users to change their name and company information

This commit is contained in:
Joseph Schorr 2017-09-26 16:58:04 -04:00
parent ad61df66c5
commit 82ff85b125
3 changed files with 67 additions and 10 deletions

View file

@ -20,6 +20,8 @@
$scope.changeEmailInfo = null;
$scope.changePasswordInfo = null;
$scope.changeMetadataInfo = null;
$scope.hasSingleSignin = ExternalLoginService.hasSingleSignin();
$scope.context = {};
@ -112,6 +114,26 @@
UIService.showPasswordDialog('Enter your password to generate an encrypted version:', generateToken);
};
$scope.showChangeMetadata = function(field_name, field_title) {
$scope.changeMetadataInfo = {
'value': $scope.context.viewuser[field_name],
'field': field_name,
'title': field_title
};
};
$scope.updateMetadataInfo = function(info, callback) {
var details = {};
details[info.field] = info.value;
var errorDisplay = ApiService.errorDisplay('Could not update ' + info.title, callback);
ApiService.changeUserDetails(details).then(function() {
$scope.context.viewuser[info.field] = info.value;
callback(true);
}, errorDisplay);
};
$scope.showChangeEmail = function() {
$scope.changeEmailInfo = {
'email': $scope.context.viewuser.email