OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Login Check

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Login Check

Postby metricgravity » Wed Jan 02, 2013 5:18 am

Hi.

I am the website manager for an OJS journal. I created a new page for the journal.

I want to create a feature which will require users to log in before accessing the page I created. However, I have not been able to do this. I would appreciate advice.

Thank you,
metricgravity
metricgravity
 
Posts: 26
Joined: Mon Mar 19, 2012 1:40 pm

Re: Login Check

Postby JasonNugent » Wed Jan 02, 2013 11:03 am

Hi metricgravity,

how did you create the new page? Did you use the static pages plugin, or some other method?

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 872
Joined: Tue Jan 10, 2006 6:20 am

Re: Login Check

Postby metricgravity » Wed Jan 02, 2013 6:49 pm

I have access to the UNIX account containing the HTML files for the journal server. I went into the account, and created the page in PHP.

Thank you for your help.

Regards,
metricgravity
metricgravity
 
Posts: 26
Joined: Mon Mar 19, 2012 1:40 pm

Re: Login Check

Postby metricgravity » Thu Jan 03, 2013 3:26 am

Hi, Jason.

I originally created the page with PHP, without the static pages plugin. After reading your message, I discovered the static pages plugin. I successfully installed it and created a practice page. However, I was not able to require a login for that page or my original one.

Thank you for your help.

Best Regards,
metricgravity
metricgravity
 
Posts: 26
Joined: Mon Mar 19, 2012 1:40 pm

Re: Login Check

Postby JasonNugent » Thu Jan 03, 2013 8:35 am

Hey metricgravity,

Yeah, I had asked about the static plugin because the pages that it creates are served up via database calls and don't require authentication. If you're creating your own content and you want access control you will probably need to extend the 'pages' handler of the section you're building on. There are a few steps for this. You'd have to add the method call to the appropriate index.php file, the necessary method to the Handler, and probably create some templates for the content. It wouldn't be a standalone page in the sense that you'd write custom PHP and just drop it into a directory within OJS. The Handler function can perform validation functions or else you can use some of the variables provided by our TemplateManager classes and so some testing in the templates via Smarty template blocks.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 872
Joined: Tue Jan 10, 2006 6:20 am

Re: Login Check

Postby metricgravity » Fri Jan 11, 2013 2:50 pm

Hi, Jason.

I was wondering if you could please give me more details on how I would set up the login check.

I created a form for an author to e-mail an editorial request to an editor. The problem is that anyone can use the form, and I only want people who are logged in to have access.

I know there are pre-prepared e-mail forms. However, I could not get these set up, so that an author could click on an editor's name, and send a message with the required information. I decided to make my own e-mail form from scratch, but I do not want it available to everyone.

Thank you for your help.

Best Regards,
metricgravity
metricgravity
 
Posts: 26
Joined: Mon Mar 19, 2012 1:40 pm

Re: Login Check

Postby JasonNugent » Tue Jan 15, 2013 10:01 am

Hi metricgravity,

Your best bet would be to look at some of the code in OJS. Specifically, I can recommend the pages/UserHandler.inc.php file, which serves up all pages related to user home pages. One of the methods in that class, index(), is responsible for serving the base user home page. You can see that one of the first things it does is call $this->validate() which uses our Validation class to determine if a person is logged in or not. If they are not logged in, they get redirected to the login page. I think this is what you want to do. You'd need to incorporate your form page into an existing handler and validate() it prior to serving the form's content. New path operations get defined in the index.php file located in each sub directory of the pages/ folder and map directly to functions in Handler classes.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 872
Joined: Tue Jan 10, 2006 6:20 am


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 3 guests