CodeIgniter Forums
Myth:Auth - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Addins (
+--- Thread: Myth:Auth (/showthread.php?tid=75039)

Pages: 1 2 3 4 5 6

RE: Myth:Auth - jim1001 - 08-18-2020

@MGatner Very kind of you - thanks! I'll take a look asap.

RE: Myth:Auth - jim1001 - 08-19-2020

@MGatner I had a quick look & tried a login which was fine. Before I install the playground (and this is probably a bit lazy I know) I see you have a logout link. How is logout implemented? I couldn't see anything in Myth:Auth docs & haven't figured it out yet Blush . Just to be clear you need to create a new, empty database before step 4 of Getting Started in Thanks!

RE: Myth:Auth - InsiteFX - 08-19-2020

The logout is a method in the AuthController, there is also a route for it so you should be able to
just do this:

PHP Code:
<?= route_to('logout');?>

// or in code as long as your Controller extends the AuthController.


Hope that helps.

RE: Myth:Auth - jim1001 - 08-19-2020

@InsiteFX Thank you! Obviously missed that. Works fine. Hadn't seen route_to before either (or it hadn't sunk in). Learning all the time. Cheers.

RE: Myth:Auth - aschmitz - 11-08-2020

Hey guys,

I'm really happy with using Myth-auth so far, many thanks to all contributors Smile

However, lately I'm wondering if it is possible to view the website from the perspective of other users?
E.g., when I'm logged in as a superadmin, it would be convenient to navigate the website from the perspective of a "basic" user (where certain modules, buttons, etc. are hidden).

Is there a possibility to do this or maybe implement this? I think a convenient place for this might be a selection option in the toolbar or such.


RE: Myth:Auth - InsiteFX - 11-08-2020

You can always ask for a feature to add request from Lonnie he may add it for you.

@ jim1001
If you take a look at the ./system/Common.php file you will find all most all of the helpers
for the core there.

RE: Myth:Auth - aschmitz - 11-09-2020

Adding a feature request was the eventual intend, but I first wanted to check here if I'm overseeing this functionality or if this is a no-go for the plugin before requesting at github :-)

RE: Myth:Auth - MGatner - 11-10-2020

@aschmitz I use this a lot, and call it “impersonation”. I don’t know that it needs to be a part of the library, you can accomplish it very easily with a controller that changes the session variable or calls the service methods. I usually just log out when I am done and log back in as “me” but I suppose some library version could maintain superadmin status despite impersonating another user?

RE: Myth:Auth - aschmitz - 11-10-2020

@MGatner, great naming, I will have to steal that Smile
The idea sounds nice, right now I'm always logging out as SA and back in a someone else but have to remember the passwords for that. Using myth-auths methods from a controller seems much easier. I will try that and try to keep track in the session whether I'm really the current user or just impersonating, thanks!
I thought it might be nice to have that functionality bundled in the debugbar, however this would kind of upgrade it from a debug bar to an action bar.

RE: Myth:Auth - suvi - 11-12-2020

Hi there.
Loving CI4 and Myth-Auth so far.. still learning though.

I'm trying to display the username in my sites top-bar. Is there a way to get the username (and other user info also) so it can be used in View files?

I tried the user() helper, but it returns an object with protected "attributes" property I can't access from within views. Maybe I'm missing some fundamental thing, again.. still learning Smile