Print Page | Close Window

How can fix to redirect after login to the page?

Printed From: openElement Website
Category:

openElement


Forum Name: Dynamic OE - Databases, etc
Forum Description: openElement's database management system and Element Packs
URL: https://forums.openelement.uk/en/forum_posts.asp?TID=914
Printed Date: Apr 19 2024 at 3:12am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How can fix to redirect after login to the page?
Posted By: djju1029
Subject: How can fix to redirect after login to the page?
Date Posted: Dec 07 2016 at 2:57pm
Hi! OE team.

My page structure is

    Homepage(summary page) ---> system status page ---> laser status page --->...and so on

The homepage is protected by Packs #50: Protect a page.

Every page is build on BaseLayer which has Packs#20: 'Mini-Login' form.

My question is that:
    1. If I logout from 'laser status page' using Packs#20 and login again, the page goes to 'laser status page'
    2. How can I redirect the page to 'Homepage' after login even user logout from any page beside 'Homepage'???
    3. In other words,
        At 'system status page' ----> logout from Packs#20 ----> login from 'user-login(connect)-v1' page ----> to 'Homepage' after successful login


Thanks in advance,

DJ Joo



Replies:
Posted By: Dmit OE
Date Posted: Dec 07 2016 at 10:59pm
Hi,

By default the login page should redirect to the homepage. Check the corresponding parameter in this Pack's configuration (on the top of the login page).

Why do you have the mini-login form on every page? Is it really necessary?


Posted By: djju1029
Date Posted: Dec 09 2016 at 1:27pm
1. Yes, the configuration of 'Page to open by default after login' of [20 - For 'Login' page (PK1)] is "index.php"
    However, if I logout from not index.php but the other page such as 'status.php' and login again from login page, the page after login is redirected to the page that is not index.php but logout page.

2. Sorry, it is my confusion.
    It is not 'mini-login form', but the packs in the BaseLayer is [61 - 'Show User' element: several format (PK7)]
    The reason why pack[61] is installed in BaseLayer because my Web App is network mornitor and control app for device, so the login user can logout anytime when he/she has done his/her job from any page.

In summary, if user logout from some page not index.php using the logout link of packs[61] and login again from login page, the redirect page is not index.php but logout page just before.

Thank you,

DJ


Posted By: djju1029
Date Posted: Dec 09 2016 at 1:47pm
For example, if user logout from '/Advance/Advance_main.php', then the redirection of login page on the address bar of browser is:

http://192.168.1.56/oe-users/user-login(connect)-v1.php?oeredirect=Advance/Advance_main.php&oelogout=1


Posted By: Dmit OE
Date Posted: Dec 10 2016 at 10:53pm
I propose you a workaround.

On the login page, you can add a simple PHP script that checks whether there's the "oeredirect" parameter specified, and no other parameters except eventually "oelogout", and reload the page without "oeredirect".

On the login page, add a Code Block (Source) type PHP position StartDocument:


if (isset($_GET['oeredirect']) && (
    (isset($_GET['oelogout']) && count($_GET) === 2) // exactly these 2 parameters present in URL - in case of using Logout
 || (count($_GET) === 1) // or only oeredirect parameter is present - in case of Login
    )
  )
{
  header('Location: ?oelogout=1');
  exit(); // request redirect without "oeredirect" and stop the page execution
}




Posted By: djju1029
Date Posted: Dec 12 2016 at 4:10pm
Thank you so much. It works!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net