-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix display LogInComponent turning blank when entering wrong username/password combination #2530
Fix display LogInComponent turning blank when entering wrong username/password combination #2530
Conversation
Reviewed by testing on DSpace 7.6. I haven't managed to pinpoint the circumstances where it occurs, but I get a blank login menu very frequently when running in dev mode. With this patch I have not noticed the blank menu even once, and everything is working as normal as far as I can tell. I'm +1 by testing. Haven't reviewed the code yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @alexandrevryghem ,
thank you for this PR, I've tested its behavior and it seems to fix that issue.
I'm glad you fixed it, but I think that we can improve the code by not using the ElementRef
and the d-none
class. Instead we should filter out for all the AuthMethodType
not configured by extending the filter
map((methods: AuthMethod[]) => methods.filter((authMethod: AuthMethod) => authMethod.authMethodType !== AuthMethodType.Ip)),
inside the log-in.component.ts
by using the new method inside the log-in.methods-decorator.ts
.
I would like to ask for these changes, Do you agree with these requests?
Thank you.
const component = rendersAuthMethodType(this.authMethod.authMethodType); | ||
if (component === undefined) { | ||
this.elRef.nativeElement.classList.add('d-none'); | ||
} | ||
return component; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the problem is that the component
is undefined, it would be better to filter out all the authMethodType
that are not configured. To achieve this behavior, you should filter them inside the log-in-component
and add the related method inside the login-in.methods-decorator
.
Do you agree @alexandrevryghem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thnx for the review @vins01-4science, I indeed do agree that it would be even better to filter them out earlier so that it never even generates a LogInContainerComponent
for AuthMethod
s without a Component
. But I would prefer to just check if the Component
is undefined though, so that it works dynamically, independently of which (future) AuthMethod
s are added.
bc34511
to
b778c74
Compare
…efore rendering LogInContainerComponent
…en the searchByObject request doesn't succeed
…' into fix-display-order-authentication-methods_contribute-7.6 # Conflicts: # src/app/shared/log-in/log-in.component.html # src/app/shared/log-in/log-in.component.ts
b778c74
to
b8eaf90
Compare
@vins01-4science, I implemented your feedback, and I also added a small commit to fix an error that I found while making the updates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @alexandrevryghem for the changes, everything seems to be correct to me 🚀 .
I am 👍 on this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks @alexandrevryghem ! Verified this fixes the bug & that reordering of login options (Shib, Password, etc) still works properly
Backport failed for Please cherry-pick the changes locally. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-2530-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-2530-to-dspace-7_x
git checkout -b backport-2530-to-dspace-7_x
ancref=$(git merge-base bf8519cc9484c144d58019c99ee65df58108dbb7 b8eaf90b03a3accd436356b85e8c7669f23eda0e)
git cherry-pick -x $ancref..b8eaf90b03a3accd436356b85e8c7669f23eda0e |
Ported to 7.6.x manually via #2575 |
References
Description
Fixes bug where the
LogInComponent
turns blank when submitting invalid username/password combination.Instructions for Reviewers
Instead of hiding the
LogInContainerComponent
by checking it's content, now it hides it by checking if the login method has a component with arendersAuthMethodType
decorator.Guidance for how to test or review this PR:
You can test it locally but I wasn't able to reproduce the bug myself with my local setup
Checklist
yarn lint
yarn check-circ-deps
)package.json
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.