Cataly...::Login(3pm)

πŸ“¦
version 0.21 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Cataly...::Login πŸ’–

okay so bestie, welcome to CatalystX::SimpleLogin::Controller::Login β€” yes that's a whole mouthful, it's giving "user contributed Perl documentation" and honestly? iconic. This is a login controller, and it's configurable, which is the whole point. grab a boba, we're doing this πŸ§‹βœ¨


✨ NAME ✨

CatalystX::SimpleLogin::Controller::Login β€” the configurable login controller, periodt. πŸ’…


🌸 SYNOPSIS 🌸

so like, for a simple usage example you should go look at CatalystX::SimpleLogin bestie, but THIS right here is the full config example, the deluxe version, the director's cut:

# For simple useage exmple, see CatalystX::SimpleLogin, this is a
# full config example
__PACKAGE__->config(
    'Controller::Login' => {
        traits => [
            'WithRedirect', # Optional, enables redirect-back feature
            '-RenderAsTTTemplate', # Optional, allows you to use your own template
        ],
        actions => {
            login => { # Also optional
                PathPart => ['theloginpage'], # Change login action to /theloginpage
            },
        },
    },
);

and if you wanna configure the actual form? go see CatalystX::SimpleLogin::Form::Login. she's the one handling that πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk β€” this is a controller base class. its whole entire job, its purpose, its moment, is to have login roles composed onto it for the login and logout actions. that's it. that's the gig. and she does it flawlessly, no cap. πŸ‘‘


πŸŽ€ ATTRIBUTES πŸŽ€

login_form_class πŸ’œ

a class attribute holding the class of the form that's gonna get initialised. you can override it in a derived class with the class of a brand new form β€” possibly one that subclasses CatalystX::SimpleLogin::Form::Login, live your truth. like so:

package MyApp::Controller::Login;

use Moose;

extends('CatalystX::SimpleLogin::Controller::Login');

has '+login_form_class' => (
    default => "MyApp::Form::Login",
);

1;

login_form_class_roles 🌈

an attribute with an array reference of roles, which get consumed by the form. you override it basically the same way as "login_form_class":

package MyApp::Controller::Login;

use Moose;

extends('CatalystX::SimpleLogin::Controller::Login');

has '+login_form_class_roles' => (
    default => sub { [qw(MyApp::FormRole::Foo MyApp::FormRole::Bar)] },
);

1;

πŸ”₯ METHODS πŸ”₯

BUILD ⭐

causes the form instance to get built at application startup. get it together early, bestie.

do_post_login_redirect πŸ™ˆ

this method does a post-login redirect. and there's a TODO sitting right there in the actual docs that says, verbatim vibes: TODO for BOBTFISH - should it even be public? if it does need to be public, then document it because the Pod coverage test failed. so yeah. that's the tea. the documentation said what it said. 😭

login πŸ’«

the login action. that's the whole description. she's straightforward.

login_redirect 🎯

redirects to the login action.

login_GET 🌸

displays the login form.

login_POST πŸ”

processes a submitted login form, and if it's correct: logs the user in and redirects. slay.

not_required πŸ¦‹

a stub action that is anchored at the root of the site ("/") and does not require registration (hence the name, iykyk).

redirect_after_login_uri πŸŒ€

so if you're using WithRedirect (which, heads up, is the default), then this method gets overridden to redirect the user back to the page they initially hit that required authentication. main character returns to where she was going. πŸ‘‘

⚠️ note bestie: even if the original URI was a post, the redirect back will only be a GET. no post, just get. that's the rule.

and if you choose NOT to compose the WithRedirect trait? then you can set the uri users get redirected to with the "redirect_after_login_uri" config key β€” or by overriding the redirect_after_login_uri method in your own login controller, if you need custom logic. your call, your power. πŸ’…

render_login_form ✨

renders the login form. by default it just calls the form's render method, simple, clean, no drama. but if you wanna do something different β€” like rendering the form with a template through your view β€” THIS is the place to hook into. this is your moment. take it. πŸŽ€

required πŸ’–

a stub action anchored at the root of the site ("/") and it does require registration (hence the name). yes she's the opposite of not_required, they're sisters.

remember_me 🧠✨

an action that gets called to deal with whether the remember me flag has been set or not. and if it HAS been set? it extends the session expiry time. queen behavior honestly.

this is only called if there was a successful login β€” so if you want a hook into that part of the process, this is a gorgeous place to hook into. and it's also obviously a great place to hook into if you wanna change how the remember me flag behaves. so many options, so much power. 🫢


πŸ’œ SEE ALSO πŸ’œ

  • CatalystX::SimpleLogin::TraitFor::Controller::Login::WithRedirect
  • CatalystX::SimpleLogin::Form::Login

πŸ‘‘ AUTHORS πŸ‘‘

see CatalystX::SimpleLogin for authors. (they're the ones behind all of this, give them their flowers πŸ’)


πŸ“œ LICENSE πŸ“œ

see CatalystX::SimpleLogin for license.


okay that's the whole page bestie, you made it to the end, I'm so proud, literally obsessed with you rn πŸ₯ΉπŸ’–

perl v5.36.0 Β· 2022-08-28 Β· and yeah, the manual name up top got shortened to Cataly...::Login(3pm) because the page header couldn't handle her full glory. she's still iconic though. bye bestie! πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from