Add comments and minor changes from PR feedback

This commit is contained in:
gconsidine
2017-07-28 15:23:08 -04:00
parent 6239df6778
commit 6a7e018100
3 changed files with 27 additions and 7 deletions

View File

@@ -70,6 +70,11 @@ function EditCredentialsController (models, $state, $scope, strings) {
_key: 'inputs'
};
/**
* If a credential's `credential_type` is changed while editing, the inputs associated with
* the old type need to be cleared before saving the inputs associated with the new type.
* Otherwise inputs are merged together making the request invalid.
*/
vm.form.save = data => {
data.user = me.getSelf().id;
credential.unset('inputs');