Login only if user is active using Laravel

前端 未结 19 1860
孤城傲影
孤城傲影 2020-11-30 23:26

I\'m currently working on my Laravel app and to prevent spam I decided that only active users are able to login. I\'m currently using Laravel\'s login system just like in La

19条回答
  •  庸人自扰
    2020-11-30 23:34

    Thanks @Can_Celik

    this was how I was able to solve my issue becos i was using json response with jquery.

    /**
         * Validate the user login request.
         *
         * @param  \Illuminate\Http\Request  $request
         * @return void
         */
        protected function validateLogin(Request $request)
        {
            $this->validate($request, [
                'email' => 'required|email|exists:users_table,email,account_status_colunm,active_value',
                'password' => 'required',
            ]);
        }
    

    then in the validation.php file add this to your Custom Validation strings

    ...
    'email' => [
            'exists' => 'Account has been disabled. Contact our team.'
        ],
    

    that's about all...works fine ...

提交回复
热议问题