mirror of https://github.com/portainer/portainer
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 offpull/5246/head
parent
caa6c15032
commit
6a39a5cf44
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in New Issue