Coder Social home page Coder Social logo

Customizing Logout about fortify HOT 6 CLOSED

laravel avatar laravel commented on April 28, 2024
Customizing Logout

from fortify.

Comments (6)

ali-alharthi avatar ali-alharthi commented on April 28, 2024 1

Fortify has the following in its config file: 'guard' => 'web'.
I am sure it only uses that guard for everything it does including the logout 👍🏼
This is what Fortify does in the destroy method a.k.a logout:

    /**
     * Destroy an authenticated session.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Laravel\Fortify\Contracts\LogoutResponse
     */
    public function destroy(Request $request): LogoutResponse
    {
        $this->guard->logout();
        $request->session()->invalidate();

        $request->session()->regenerateToken();

        return app(LogoutResponse::class);
    }

I believe @taylorotwell built Fortify to be the official Laravel package for authentication. However, consider it as a skeleton, so you can implement your logic by extending classes or simply build a package that consumes in the way you want. Like Jetstream for example.

from fortify.

driesvints avatar driesvints commented on April 28, 2024 1

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

from fortify.

digenPrime avatar digenPrime commented on April 28, 2024 1

I want to add an activity and save that activity in database such that "@username has logged out at H:i:s". Can someone tell me how to do override the logout functionality in the above code that @ali-alharthi has provided? @driesvints @ali-alharthi.

from fortify.

oldravian avatar oldravian commented on April 28, 2024

this issue should be open. how to overwrite the method mentioned by @ali-alharthi

from fortify.

ali-alharthi avatar ali-alharthi commented on April 28, 2024

@digenPrime You should read more about events. It should direct you to the correct way.
@ChaudharyHabib This isn't an issue as explained by @driesvints
Nevertheless, you can overwrite it by simply, use a custom routes and use you custom controller that extends Fortify's controller or simply build yours. I wouldn't go into deep but here is a key thing: Fortify::ignoreRoutes();.

from fortify.

cartayapardo avatar cartayapardo commented on April 28, 2024

Hello, I am using fortify and it happens that when I logout and try to login with another user, I access with the previous user and not with the new one. This does not always happen, what can be wrong?

from fortify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.