fix(git-form): show git form and clear auth values (#5224)

* fix(custom-templates): show git form

fix [EE-1025]

* fix(git-form): empty auth values when auth is off
pull/5246/head
Chaim Lev-Ari 2021-06-22 12:41:50 +03:00 committed by GitHub
parent caa6c15032
commit 6a39a5cf44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View File

@ -1,8 +1,13 @@
class GitFormComposeAuthFieldsetController {
/* @ngInject */
constructor() {
this.authValues = {
username: '',
password: '',
};
this.onChangeField = this.onChangeField.bind(this);
this.onChangeAuth = this.onChangeField('RepositoryAuthentication');
this.onChangeAuth = this.onChangeAuth.bind(this);
this.onChangeUsername = this.onChangeField('RepositoryUsername');
this.onChangePassword = this.onChangeField('RepositoryPassword');
}
@ -15,6 +20,35 @@ class GitFormComposeAuthFieldsetController {
});
};
}
onChangeAuth(auth) {
if (!auth) {
this.authValues.username = this.model.RepositoryUsername;
this.authValues.password = this.model.RepositoryPassword;
this.onChange({
...this.model,
RepositoryAuthentication: true,
RepositoryUsername: '',
RepositoryPassword: '',
});
return;
}
this.onChange({
...this.model,
RepositoryAuthentication: false,
RepositoryUsername: this.authValues.username,
RepositoryPassword: this.authValues.password,
});
}
$onInit() {
if (this.model.RepositoryAuthentication) {
this.authValues.username = this.model.RepositoryUsername;
this.authValues.password = this.model.RepositoryPassword;
}
}
}
export default GitFormComposeAuthFieldsetController;

View File

@ -103,7 +103,7 @@
</div>
<!-- !upload -->
<!-- repository -->
<git-form ng-if="state.Method === 'repository'" model="$ctrl.formValues" on-change="($ctrl.onChangeFormValues)"></git-form>
<git-form ng-if="$ctrl.state.Method === 'repository'" model="$ctrl.formValues" on-change="($ctrl.onChangeFormValues)"></git-form>
<!-- !repository -->
<por-access-control-form form-data="$ctrl.formValues.AccessControlData"></por-access-control-form>