Skip to content
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

Again phantom error after update to v5.3.2 #109

Closed
hookenful opened this issue May 23, 2022 · 13 comments
Closed

Again phantom error after update to v5.3.2 #109

hookenful opened this issue May 23, 2022 · 13 comments

Comments

@hookenful
Copy link

Hi there!

Getting again that strange problem while activating update-password link from email:
image

Source code of error page:
https://pastebin.com/TxQPpR4x

Thank for any help!

@garronej
Copy link
Collaborator

Hi @hookenful,

Thanks for the snippet, unfortunately you copy pasted to me the code of the error.ftl page, there isn't anything on the page you sent be that makes Keycloak throw.

The error is on the info.ftl page.

@hookenful
Copy link
Author

https://pastebin.com/YRFgT3eN Is that info.ftl page? Maybe you mean that one that we are skipping.

@garronej
Copy link
Collaborator

garronej commented May 23, 2022

Yes it should be the one you are skipping.

@hookenful
Copy link
Author

hookenful commented May 23, 2022

Look at our KcApp . Maybe we missed something? <>

How can I get there meaning that we are skipping it?
What can I do on my our side to prevent such errors?

@hookenful
Copy link
Author

hookenful commented May 23, 2022

<>

@garronej
Copy link
Collaborator

There isn't anything that you can do on your end to prevent this error, ony sollution is to give me the HTML code of the page info.ftl.

You have two option:

  1. Try to play with the chrome debugger to pause before redirecting: https://gist.github.com/carcinocron/f6a509b84fe82a718816
  2. Comment out window.location.href = kcContext.actionUri; just time to copy the page and past it to me.

@hookenful
Copy link
Author

hookenful commented May 23, 2022

I suppose this one is Info.ftl: <>

And one more question, in regular basis I see that this is (
image) is blinking before window.location.href = kcContext.actionUri;
Is it possible to prevent blinking? I should define an empty KcInfo then?

@garronej
Copy link
Collaborator

https://pastebin.com/DTwRdPwZ

The link is dead

@hookenful
Copy link
Author

hookenful commented May 23, 2022

Sorry, here it is <>

garronej added a commit that referenced this issue May 23, 2022
@garronej
Copy link
Collaborator

Hi @hookenful, thank you for your contribution,
It should be fixed 5.4.0.
Do you confirm?

@hookenful
Copy link
Author

Hi @hookenful, thank you for your contribution, It should be fixed 5.4.0. Do you confirm?

Thanks for your effort, I need to deploy on swarm and then I'll reply for that, ok?

@garronej
Copy link
Collaborator

@hookenful You are welcome,

Is it possible to prevent blinking? I should define an empty KcInfo then?

This should do it:

import React, { useLayoutEffect } from 'react';

import { KcFormLogin } from 'components/Keycloack/KcFormLogin';
import { KcFormPage } from 'components/Keycloack/KcFormPage';
import { KcFormResetPassword } from 'components/Keycloack/KcFormResetPassword';
import { KcContextBase } from 'keycloakify';
import { KcApp as KcAppBase } from 'keycloakify/lib/components/KcApp';

import { KcFormUpdatePassword } from './KcFormUpdatePassword';

import type { KcProps } from 'KcTypes/kcProps';

export const KcApp = React.memo(({ kcContext, ...props }: { kcContext: KcContextBase } & KcProps) => {
  useLayoutEffect(() => {
    if (kcContext.pageId === 'info.ftl' && kcContext.actionUri !== undefined) {
      window.location.href = kcContext.actionUri;
    }
  }, [kcContext.pageId]);

  switch (kcContext.pageId) {
+  case 'info.ftl':
+    return null;
    case 'login.ftl':
      return <KcFormLogin {...{ kcContext: kcContext as KcContextBase.Login & KcProps, ...props }} />;
    case 'login-page-expired.ftl':
      return <KcFormPage {...{ kcContext: kcContext as KcContextBase.LoginPageExpired & KcProps, ...props }} />;
    case 'login-reset-password.ftl':
      return (
        <KcFormResetPassword {...{ kcContext: kcContext as KcContextBase.LoginResetPassword & KcProps, ...props }} />
      );
    case 'login-update-password.ftl':
      return (
        <KcFormUpdatePassword {...{ kcContext: kcContext as KcContextBase.LoginUpdatePassword & KcProps, ...props }} />
      );
    default:
      return <KcAppBase {...{ kcContext, ...props }} />;
  }
});

@hookenful
Copy link
Author

This should do it:

Worked like a charm, very thankful :) Cya, have a nice evening, Joseph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants