Issue 95: username/password for GitHub should be removed - no longer available #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To actually achieve this, much of the directive is rewritten.
The management type string needs to be passed to the directive so that it can be determined whether or not the type has changed.
With the previous design, one could not reliably determine if/when the username/password fields should disappear or not.
The original management type is saved and then the auth information is updated if the management type changes.
It also turns out that if a watch is not used, then there is no reliable way to determine if the management type is the correct value.
Closing the modal and opening up a new model is a way to potentially get the wrong information as the data from the previous open model may be preserved.
I would argue that this is a pre-existing bug that needed to be fixed to ensure that the changes here work as expected.
The isAuthRequired() function is rewritten to better handle when the 'auth' checkbox should be presented or not.
This function then should only run when needed to avoid resetting auth data when the auth data should not be reset.
The originalType should be uninitialized so that the very first run can handle setting the auth.required.
In all other cases the auth.required should never be set when the management type changes.
This is, in part, because the auth data gets cleared and it could incorrectly set the auth.useToken value.
The hasToken() function has been replaced with refreshAuth() to achieve all of this.
The name is changed to better clarify the purpose and intent of the function.
This commit requires changes in the service.
resolves TAMULib/ProjectManagementService#95
relates TAMULib/ProjectManagementService#97