Z
Z
Zhandos M2015-06-21 19:42:55
Yii
Zhandos M, 2015-06-21 19:42:55

Why does yii2-authclient use js redirect to user's returnUrl?

Which is very strange and does not always work, because. there are problems with js on the mobile version, users often refresh the page and get the expected error. Wouldn't it be better to do the redirect using the backend?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Belikov, 2015-06-25
@Zhandos

I looked at the source and this is what I found .

function popupWindowRedirect(url, enforceRedirect)
{
    if (window.opener && !window.opener.closed) {
        if (enforceRedirect === undefined || enforceRedirect) {
            window.opener.location = url;
        }
        window.opener.focus();
        window.close();
    } else {
        window.location = url;
    }
}
popupWindowRedirect(<?= Json::htmlEncode($url) ?>, <?= Json::htmlEncode($enforceRedirect) ?>);

As I understand it, there is a check whether the user has a pop-up window open (where he logs in) and if not, then he is simply redirected to a successful page after authorization.
That is, the reason is in the popup window .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question