Jump to content
  • 0

Code to redirect to login page


DerekO87

Question

Good evening.   I am a new Caspio user and have been working on an App.   I currently have a Wordpress hosted website for the App that has a home page and several other pages.   On the home page, the menu has the links to pages for the various user roles, Admin, Employee, etc.   When you click on one of the roles, it brings up a login.  The App is using a Caspio HTML data page to login in for the various authentication levels.  Once you login, it redirects you to another page on the website that I am using as a dashboard.  I have a separate dashboard for each of the various roles.     It is working; however, right now, you can enter the URL of the other pages for the various dashboards and bypass the login page.    Not sure if I am taking the correct approach.  Have been looking on Wordpress and other sites and they reference a code that I can enter on each page to prevent someone from directly entering the URL of the page if not logged in and that can redirect them back to the various login pages if they are not logged in.  I believe the login though is for the WordPress site and not the login HTML Data Page that I am using.  I have the ability to add a 'snippet' directly to each of my pages.  If there is another way to work this problem, I am grateful for any suggestions that anyone may have.  Thank you in advance for any assistance, critiques, and/or for pointing me in the right direction!  

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi @DerekO87, what I can suggest is to authenticate your datapages as well and insert your login page as the designated entry page: https://howto.caspio.com/authentications-and-connections/authentication/authentication/#:~:text=Designated entry page. After that, even if they access the direct URL of your datapages, they will still be redirected to your login page.

 

-Potato

Link to comment
Share on other sites

  • 0

Thank you for your response.  On my website, I have an admin page that has links to the pages that have Datapages that authenticated admins can access.  For example, when you click on  Admin on the menu of my homepage it takes you to the HTML datapage to login in if you are an admin.  Once logged in you are redirected to a page with a dashboard for admin that has buttons with links to various pages that have varous data pages on them like 'add users' and 'manage users' for example.  I was able build an authentication for the add user page with designated entry.    You can login to the admin dashboard from the home page still but when you click the add user link, it takes you back to the admin login page, so I am still missing something.  Thank you again for your assistance. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...