0

I want to encrypt data fields of user table and i don't want to break the the laravel default Auth functionality.

I want something like this

DB::table('client')->insertGetId(
        array(
        'name'  =>DB::raw("AES_ENCRYPT('".$data['name']."', '".env('DB_ENCRYP_KEY')."')"), 
        'email' => DB::raw("AES_ENCRYPT('".$data['email']."', '".env('DB_ENCRYP_KEY')."')"), 
        'password' => DB::raw("AES_ENCRYPT('".$data['password']."', '".env('DB_ENCRYP_KEY')."')")

        )

);

want to use ASE_ENCRYPT in query level. I just need to know where can i find the raw MySQL query for Laravel authentication module. So i can change those query like this. what is the file name ?

2 Answers 2

1

Instead of using auth()->attempt(), query for the user yourself, then use the login method.

For example, in your controller's login method:

public function login()
{
    $user = User::where(...)->first();

    if ($user) {
        auth()->login($user);

        return redirect()->intended();
    }

    return redirect()->back()->withErrors('Wrong credentials');
}
Sign up to request clarification or add additional context in comments.

Comments

0

If you mean using the default app created with the laravel new command, then you are looking for the create method in AuthController.php (app/Http/Controllers/Auth/AuthController.php)

The create method is called from the trait RegistersUsers.php wrapped in an Auth::login method, so just be sure to return an instance of your User model instead of just the ID (as with the insertGetId method)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.