[PHP] PlexAuth - Authentication for your domain using Plex

Yeah thats right. So don’t worry about editing the CSS.

<input id="email" name="PlexEmail" type="email" class="validate tooltipped" data-position="top" data-delay="50" data-tooltip="Use your Plex credentials" autocomplete="off">
to be:
<input id="email" name="PlexEmail" type="text" class="validate tooltipped" data-position="top" data-delay="50" data-tooltip="Use your Plex credentials" autocomplete="off">

The type username isn’t a HTML type. Use text you won’t need to edit any CSS

Success, be sure to add that to your code.

testing out your new version, the PlexAuth solution was skipped completed since there’s an error I discovered at:

Parse error: syntax error, unexpected ‘}’ in /usr/share/nginx/html/plexauth/inc/PlexUser.class.php on line 215

Once I removed that unexpected bracket, I got the login page. CSS is messed up, but working on that component now.

Thanks for that. I’ve fixed the extra bracket.

I had a mate of mine skin the hell out of my local version so unfortunately the CSS might be a little funky. I think he is going to upload his skin in a few days or so…

Here is a bit of a teaser.

That’s nice. The CSS is fixed, had to reapply my tweaks to the login.page.php. I had to go through the upgrade since I had 1 or 2 users that were sometimes able to get in and sometimes they weren’t able to. They are entering the correct credentials (haven’t tested this new version with them yet) but the page would just reset for them to enter their credentials again (sometimes this works, sometimes it doesn’t).

What changes did you have to make to get the current CSS going again?

Are you now using username instead of email? Has this resolved the issue for your broken users?

Your default theme is working for the login page, mine is customized with the video and also the ability for users to log in with either a username or email.

Oh okay excellent!

PM me if you like and we can try and work through these issues with your broken users.

Quick question how do I call muximux’s index.php (which is in a different directory) locally, since you’ve changed the code from “header” to “requirement” in the rememberme.php when calling main.page.php.

Before you suggested running header(“Location: https://domain.com.index.php”); //this would point to muximux

muximux and plexauth folders both sit in my base folder for (usr/share/nginx/html/)
usr/share/nginx/html/plexauth/index.php
usr/share/nginx/html/muximux/index.php

using your old line still works but I want to see if there’s an alternative, using your new require calls.

I’ve tried inserting:
$path = $_SERVER[‘DOCUMENT_ROOT’];
$path .= “/muximux/index.php”;

then in the new require line just added:** require($PATH);**

it then throws me this error: ‘/usr/share/nginx/html/muximux/index.php/tokens’ does not exist or is not writable by the web server. To run the example, please create the directory and give it the correct permissions.

got it working with replacing line 74 of rememberme.php:
require(‘main.page.php’);
to:
header(“Location: https://muximuxdomain.com/index.php”, true, 302);
exit;

Doing the header method is fine. You could also just replace the contents of main.page.php with header("Location: https://domain.com.index.php"); which should work also. Essentially all you are doing is redirecting the user back to your main page.

Yes, thanks for the tip. After extensive testing there’s like a 10% success rate when people try to log in with their username opposed to email. Great tool though.

Really!? Hmmm maybe there are some bits I haven’t thought though when making the suggestion…

Is it the same 10% of people that fail? or is it a hit and miss for each person?

Yes, I do also believe some of the rules of CloudFlare WAF (web app firewall at the cloud level) are impacting the process. Since Fail2Ban is made essentially useless, CloudFlare’s WAF made sense for additional protection, hopefully PLEX adds two factor one day as well. I had some users also test out the solution in incognito mode, for example in the mobile app Dolphin Zero upon successful login you will be brought to a blank tab. If you re-enter the original domain, it then allow you in since you were successful etc. Lastly, regarding your question, I can login with my username just fine but that’s not the case with others, it’s weird. Thanks.

Hmm I haven’t tested with CF WAF as I don’t have a pro account. I’m not sure why that would break anything though.

I have tested with a few of my users and everything works as expected when using their usernames as opposed to email addresses.

@DallasHQ
Sent you a PM with some info.

@hjone72 said:
Thanks for that. I’ve fixed the extra bracket.

I had a mate of mine skin the hell out of my local version so unfortunately the CSS might be a little funky. I think he is going to upload his skin in a few days or so…

Here is a bit of a teaser.

Where can i found this amazing skin? <3

@Pieter-basonline said:
Where can i found this amazing skin? <3

Hmmm. He was going to post it on github. I’ll hit him up and see what I can arrange.

EDIT:
I’ve published a new branch of the project.

Check it out and let me know if i’ve missed anything with the commit.

Any chance of an Apache version?

Unfortunately because the crux of this is based around nginx’s auth_request module Apache would not work…

Doing a quick Google you might be able to make this work: