Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2012-03-28 15:05:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

planeth wrote:

strrchr(txpath, "/") is not gonna work

FYI, use this instead:

strrchr(txpath, DS)

since it’s a multi-site install, admin side url will be local.site/admin

Yes, and if anyone solves this, please let me know how you did it, because the core needs the same fix for multi-site when dealing with password resets and user registration. Would love to get that bit fixed once and for all.

Last edited by Bloke (2012-03-28 15:06:02)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#50 2012-03-28 15:30:08

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Bloke a écrit:

FYI, use this instead:
strrchr(txpath, DS)

Noted down for next release, thx.

the same fix for multi-site

Maybe a network specialist could tell if there is a clean way to determine whether the admin path is
www.example.com/admin/ or admin.example.com or www.example.com/textpattern/ ?

Offline

#51 2012-03-28 15:50:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

CeBe wrote:

a clean way to determine whether the admin path is www.example.com/admin/ or admin.example.com or www.example.com/textpattern/

It’s not exactly what I’d call clean but the split and hope method is the closest I’ve found to a solution:

// Test array. Add test cases here...
$url = array(
   'http://www.example.com/admin/',
   'http://www.example.com/textpattern/',
   'https://www.example.com/admin/',
   'www.example.com/admin/',
   'example.com/admin/',
   'example.com/textpattern/',
   'admin.example.com',
);
dmp($url);

foreach ($url as $link) {
   // Remove protocol because the optional slashes get in the way of finding the domain
   $link = str_replace(array('http://', 'https://', 'ftp://'), '', $link);

   // Splittah!
   $parts = do_list($link, '/');
   $domain = array_shift($parts);
   $admin_subdir = isset($parts[0]) ? $parts[0] : '';
dmp($admin_subdir);
}

Note that the final subdomain example identifies the admin subdir as '' because you’d set your site_url up to match the subdomain… at least I hope that’s the case!

Totally untested and most likely there are corner cases where it’d fail, or it may be completely unsuitable. Discuss :-)

Last edited by Bloke (2012-03-28 15:53:52)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#52 2012-03-28 16:15:22

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 234
Website GitHub Mastodon

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Would it be too much of a hassle/not txply correct to add path/to/admin in prefs ?

Offline

#53 2012-03-28 21:53:20

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

planeth a écrit:

Would it be too much of a hassle/not txply correct to add path/to/admin in prefs ?

For future releases, it would be lovely :) Feature request ?
Right now we have to do with what we have (or don’t). What about this :

// First determine possible admin URLs
// (do it here)
// should give the following array, order is important :

$url = array( 'www.example.com/admin'          // or 'example.com/admin', depending on preferences
            , 'www.example.com/textpattern'    // ditto
            , 'admin.example.com'
            ) ;

foreach( $url as $link )
{
    $headers = @get_headers( $adm_url = PROTOCOL . $link . '/' ) ;
    if( $headers !== false && strpos( $headers[ 0 ], '404' ) === false )
        break ;
}

// got it in $adm_url

Fully untested neither, it’s just an idea.

Last edited by CeBe (2012-03-28 21:54:38)

Offline

#54 2012-03-29 08:14:06

planeth
Plugin Author
From: Nantes, France
Registered: 2009-03-19
Posts: 234
Website GitHub Mastodon

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

AFAIK, that seems smart :)

The one problematic point is if you got an admin url like www.example.com/my-funky-unguessable-admin-name …
But since the wiki way for multi-site is admin for url, not many people will change for another name. Though it might be a wise move from a security point of vue.
My 2 cents !

Offline

#55 2012-05-20 13:30:04

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hi claire

it seems a little bug in your code (9.1)

when i use cbe_login_with value=“email” there something showing on top of the page “array(login=“with” ! i thinked it s due to testing mode of textpattern but even on live mode it not disapear.

Cheers

Offline

#56 2012-06-04 15:16:46

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Dragondz a écrit:

there something showing on top of the page

Ahem… Removed a parasitic var_dump in 0.9.2.
Thank you, and sorry.

Offline

#57 2012-07-12 04:53:45

photonomad
Member
Registered: 2005-09-10
Posts: 290
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Hello Claire,

This is an awesome plugin! I’m testing it out for the first time (along with cbe_members, smd_bio and smd_user_manager). Sometimes I login and then navigate to another page/section and I’m logged out unexpectedly (the login form shows up again). Other times, I login and everything works as it should. It is very unpredictable – happens on different pages and with different users. This has happened both on Chrome and Safari. Here is a link to my test site: http://photonomad.com/treetest/

Two sample logins (no back end privileges) are:
name: msue pw: password
name: msmith pw: password

Any ideas as to what is happening?

Thanks,
Stacey

Offline

#58 2012-07-12 05:12:20

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

Any change you are trying to log in with the same account to admin-side too, or you are logged in with same user in multiple browsers? In either of those scenarios, you would thrown out. Single account can only be used in single client instance.

As the test site goes, I personally see no issues. Logging in works fine, cookies are created properly, it updates session hashes and so on. Nothing out of the ordinary.

Offline

#59 2012-07-12 08:08:24

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

photonomad a écrit:

Sometimes I login and then navigate to another page/section and I’m logged out unexpectedly (the login form shows up again). Other times, I login and everything works as it should.

That’s because sometimes the URL is with www (http://www.photonomad.com), sometimes without (http://photonomad.com), these are two different domains and two different sets of cookies.

Back to the help file and read the Quick start paragraph :)

Offline

#60 2012-07-26 12:39:08

hilaryaq
Plugin Author
Registered: 2006-08-20
Posts: 335
Website

Re: cbe_frontauth: Connect to (and disconnect from) backend from frontend

I actually love you right now.


…………………
I <3 txp
…………………

Offline

Board footer

Powered by FluxBB