Index: app/Http/Controllers/Auth/ForgotPasswordController.php
===================================================================
--- app/Http/Controllers/Auth/ForgotPasswordController.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ app/Http/Controllers/Auth/ForgotPasswordController.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -3,4 +3,5 @@
 namespace App\Http\Controllers\Auth;
 
+use App\Helpers\Alert;
 use App\Http\Requests\Auth\ForgotPasswordRequest;
 use App\Models\User;
@@ -33,5 +34,5 @@
         $user->notify(new ForgotPassword($user));
 
-        $request->session()->flash("forgotInfo", "We have sent an email to your inbox.");
+        Alert::flash( "We have sent an email to your inbox", "error");
 
         return redirect()->route("auth.forgotShow");
Index: app/Http/Controllers/Auth/LoginController.php
===================================================================
--- app/Http/Controllers/Auth/LoginController.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ app/Http/Controllers/Auth/LoginController.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -3,12 +3,16 @@
 namespace App\Http\Controllers\Auth;
 
+use App\Helpers\Alert;
 use App\Http\Requests\Auth\LoginRequest;
 use App\Models\User;
 use App\Http\Controllers\Controller;
+use App\Notifications\VerifyUser;
+use App\Services\Hashid;
 use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Str;
 
 class LoginController extends Controller
 {
-    protected $redirectTo = '/dashboard';
+    protected $redirectTo = '/';
 
     public function __construct()
@@ -22,36 +26,39 @@
     }
 
-    public function login(LoginRequest $request)
+    public function login(LoginRequest $request, Hashid $hashid)
     {
         $user = User::whereUsername($request->username)->first();
 
+        if (is_null($user)) {
+            Alert::flash("Please check your credentials", "error");
+            return redirect()->route("auth.login");
+        }
+
         if (!$user->is_active) {
-            $request->session()->flash("isActiveError", "Your account is blocked or its not confirmed yet. Please contact with your system administrator or check your email.");
-            return redirect()->back();
+            Alert::flash("Your account is blocked or its not confirmed yet. Please contact with your system administrator or check your email.", "error");
+            return redirect()->route("auth.login");
         }
 
         if (!Hash::check($request->password, $user->password)) {
-            $request->session()->flash("passwordError", "Your password is incorrect");
-            return redirect()->back()->withInput($request->input());
+            Alert::flash("Your password is incorrect", "error");
+            return redirect()->route("auth.login");
         }
 
-        if (auth()->attempt([
-            "username" => $request->username,
-            "password" => $request->password,
-            "is_active" => true], $request->remember)) {
-
-            $user->is_online = true;
-            $user->save();
-
-            return redirect()->intended('/dashboard');
-        }
-
+        //$user->security_code = rand(10000, 99999);
         if ($user->is_forgot_password) {
             $user->is_forgot_password = false;
         }
 
-        $request->session()->flash("loginError", "An error occurred while login. Please try again later.");
+            $user->security_code = 1234;
+            $user->verify_token = Str::uuid();
+            $user->is_online = true;
+            $user->save();
 
-        return redirect()->back()->withInput($request->input());
+            $user->notify(new VerifyUser($user));
+
+            return redirect()->route("verify-login.index", [
+                "id" => $hashid->encode($user->id),
+                "token" => $user->verify_token
+            ]);
     }
 
Index: app/Http/Controllers/Auth/VerifyLoginController.php
===================================================================
--- app/Http/Controllers/Auth/VerifyLoginController.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
+++ app/Http/Controllers/Auth/VerifyLoginController.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -0,0 +1,31 @@
+<?php
+
+namespace App\Http\Controllers\Auth;
+
+use App\Helpers\Alert;
+use App\Http\Controllers\Controller;
+use App\Models\User;
+use Illuminate\Http\Request;
+use App\Services\Hashid;
+
+class VerifyLoginController extends Controller
+{
+    public function index()
+    {
+        return view("auth.verify-login");
+    }
+
+    public function verify(Request $request, Hashid $hashid, $id, $token)
+    {
+        $user = User::findOrFail($hashid->decode($id));
+
+        if($request->code != $user->security_code) {
+            Alert::flash("Security code is wrong", "error");
+            return redirect()->back();
+        }
+
+        auth()->login($user);
+
+        return redirect()->route("dashboard.index");
+    }
+}
Index: app/Http/Controllers/Auth/VerifyNewEmailController.php
===================================================================
--- app/Http/Controllers/Auth/VerifyNewEmailController.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ 	(revision )
@@ -1,32 +1,0 @@
-<?php
-
-namespace App\Http\Controllers\Auth;
-
-use App\Http\Requests\Auth\VerifyNewEmailRequest;
-use App\Models\User;
-use App\Http\Controllers\Controller;
-
-class VerifyNewEmailController extends Controller
-{
-    public function __construct()
-    {
-        $this->middleware("checkVerifyNewEmail");
-    }
-
-    public function create($id, $token)
-    {
-        return view("auth.verify")->with([
-            "id" => $id,
-            "token" => $token
-        ]);
-    }
-
-    public function verify(VerifyNewEmailRequest $request, $id, $token)
-    {
-        $user = User::find($id);
-        $user->is_active = true;
-        $user->save();
-
-        return redirect()->route("auth.login");
-    }
-}
Index: app/Http/Kernel.php
===================================================================
--- app/Http/Kernel.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ app/Http/Kernel.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -71,4 +71,5 @@
         'permission' => \App\Http\Middleware\CheckPermission::class,
         'checkIsActive' => \App\Http\Middleware\CheckIsActive::class,
+        'CheckVerifyToken' => \App\Http\Middleware\CheckVerifyToken::class
     ];
 }
Index: app/Http/Middleware/CheckVerifyToken.php
===================================================================
--- app/Http/Middleware/CheckVerifyToken.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
+++ app/Http/Middleware/CheckVerifyToken.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -0,0 +1,31 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use App\Models\User;
+use App\Services\Hashid;
+use Closure;
+
+class CheckVerifyToken
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param \Illuminate\Http\Request $request
+     * @param \Closure $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        $hashId = new Hashid();
+        $id = $request->route("id");
+        $token = $request->route("token");
+        $user = User::findOrFail($hashId->decode($id));
+
+        if ($user->verify_token !== $token || now()->greaterThan($user->updated_at->addMinutes(1))) {
+            return redirect()->route("auth.login");
+        }
+
+        return $next($request);
+    }
+}
Index: app/Models/User.php
===================================================================
--- app/Models/User.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ app/Models/User.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -28,5 +28,7 @@
         "password",
         "avatar",
-        "role_id"
+        "role_id",
+        "security_code",
+        "verify_token"
     ];
 
@@ -39,5 +41,7 @@
         "password",
         "remember_token",
-        "is_active"
+        "is_active",
+        "verify_token",
+        "security_code"
     ];
 
Index: app/Notifications/VerifyNewEmail.php
===================================================================
--- app/Notifications/VerifyNewEmail.php	(revision 796e7ac8ee4dca609623c430b1385abc22b2b5bf)
+++ 	(revision )
@@ -1,64 +1,0 @@
-<?php
-
-namespace App\Notifications;
-
-use App\Models\User;
-use Illuminate\Bus\Queueable;
-use Illuminate\Notifications\Notification;
-use Illuminate\Notifications\Messages\MailMessage;
-
-class VerifyNewEmail extends Notification
-{
-    use Queueable;
-
-    private $user;
-
-    /**
-     * Create a new notification instance.
-     *
-     * @return void
-     */
-    public function __construct(User $user)
-    {
-        $this->user = $user;
-    }
-
-    /**
-     * Get the notification's delivery channels.
-     *
-     * @param  mixed  $notifiable
-     * @return array
-     */
-    public function via($notifiable)
-    {
-        return ['mail'];
-    }
-
-    /**
-     * Get the mail representation of the notification.
-     *
-     * @param  mixed  $notifiable
-     * @return \Illuminate\Notifications\Messages\MailMessage
-     */
-    public function toMail($notifiable)
-    {
-        return (new MailMessage)
-            ->greeting("Hello " . $this->user->name)
-            ->line("To verify your new email click the button.")
-            ->line("Your security code is: " . $this->user->security_code)
-            ->action("Verify", url("/auth/verify/" . $this->user->id . "/" . $this->user->verify_token));
-    }
-
-    /**
-     * Get the array representation of the notification.
-     *
-     * @param  mixed  $notifiable
-     * @return array
-     */
-    public function toArray($notifiable)
-    {
-        return [
-            //
-        ];
-    }
-}
Index: app/Notifications/VerifyUser.php
===================================================================
--- app/Notifications/VerifyUser.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
+++ app/Notifications/VerifyUser.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -0,0 +1,74 @@
+<?php
+
+namespace App\Notifications;
+
+use App\Models\Company;
+use App\Models\User;
+use App\Services\Hashid;
+use Illuminate\Bus\Queueable;
+use Illuminate\Contracts\Queue\ShouldQueue;
+use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Notifications\Notification;
+
+class VerifyUser extends Notification implements ShouldQueue
+{
+    use Queueable;
+
+    protected $user;
+
+    /**
+     * Create a new notification instance.
+     *
+     * @return void
+     */
+    public function __construct(User $user)
+    {
+        $this->user = $user;
+    }
+
+    /**
+     * Get the notification's delivery channels.
+     *
+     * @param mixed $notifiable
+     * @return array
+     */
+    public function via($notifiable)
+    {
+        return ['mail'];
+    }
+
+    /**
+     * Get the mail representation of the notification.
+     *
+     * @param mixed $notifiable
+     * @return \Illuminate\Notifications\Messages\MailMessage
+     */
+    public function toMail($notifiable)
+    {
+        $hashId = new Hashid();
+
+        return (new MailMessage)
+            ->greeting("Login verification")
+            ->line("To verify click the button and enter your security code.")
+            ->line("Your security code is: " . $this->user->security_code)
+            ->action("Verify", route("verify-login.index", [
+                "id" => $hashId->encode($this->user->id),
+                "token" => $this->user->verify_token
+            ]));
+    }
+
+    /**
+     * Get the array representation of the notification.
+     *
+     * @param mixed $notifiable
+     * @return array
+     */
+    public function toArray($notifiable)
+    {
+        return [
+            //
+        ];
+    }
+
+
+}
Index: app/Services/Hashid.php
===================================================================
--- app/Services/Hashid.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
+++ app/Services/Hashid.php	(revision a3838770e4d69dee3401724b6e0725d8e1901d73)
@@ -0,0 +1,29 @@
+<?php
+
+namespace App\Services;
+
+use Hashids\Hashids;
+
+class Hashid
+{
+    protected $hashid;
+
+    public function __construct()
+    {
+        $this->hashid = new Hashids(config("app.key"), 6, "0123456789abcdefg");
+    }
+
+    public function decode($id)
+    {
+        return $this->hashid->decode($id)[0];
+    }
+
+    public function __call($method, $args)
+    {
+        if (!method_exists($this->hashid, $method)) {
+            throw new \Exception("Call to undefined method '{$method}'");
+        }
+
+        return call_user_func_array([$this->hashid, $method], $args);
+    }
+}
