diff --git a/app/Http/Controllers/Api/LogInController.php b/app/Http/Controllers/Api/LogInController.php
new file mode 100644
index 00000000..f5028d9f
--- /dev/null
+++ b/app/Http/Controllers/Api/LogInController.php
@@ -0,0 +1,52 @@
+validate([
+ 'email' => ['required'],
+ 'password' => ['required'],
+ ]);
+
+ if (
+ Auth::attempt([
+ 'email' => $request->input('email'),
+ 'password' => $request->input('password'),
+ ])
+ ) {
+ LoginAttempt::create([
+ 'user_id' => Auth::user()->id,
+ 'ip' => $request->ip(),
+ 'failed' => false,
+ ]);
+
+ return response()
+ ->json([
+ 'token' => 'TOKEN_GOES_HERE',
+ ]);
+ } else {
+ $userByEmail = User::query()
+ ->where('email', $request->input('email'))
+ ->first();
+
+ LoginAttempt::create([
+ 'user_id' => $userByEmail ? $userByEmail->id : null,
+ 'ip' => $request->ip(),
+ 'failed' => true,
+ ]);
+
+ return response()
+ ->json(['error' => 'UNABLE_TO_LOG_IN']);
+ }
+ }
+}
diff --git a/resources/assets/js/prototype/app.js b/resources/assets/js/prototype/app.js
index 9d60f8cd..f2e982e8 100644
--- a/resources/assets/js/prototype/app.js
+++ b/resources/assets/js/prototype/app.js
@@ -4,6 +4,7 @@ import VueRouter from 'vue-router';
import App from './components/App.vue';
import Login from './screens/Login.vue';
+import Dashboard from './screens/Dashboard.vue';
Vue.use(VueRouter);
@@ -12,6 +13,10 @@ const routes = [
path: '/prototype/login',
name: 'login',
component: Login,
+ }, {
+ path: '/prototype/dashboard',
+ name: 'dashboard',
+ component: Dashboard,
},
];
diff --git a/resources/assets/js/prototype/screens/Dashboard.vue b/resources/assets/js/prototype/screens/Dashboard.vue
new file mode 100644
index 00000000..4c14c6f3
--- /dev/null
+++ b/resources/assets/js/prototype/screens/Dashboard.vue
@@ -0,0 +1,11 @@
+
+
+
+
+
diff --git a/resources/assets/js/prototype/screens/Login.vue b/resources/assets/js/prototype/screens/Login.vue
index 0c56170e..0d63e077 100644
--- a/resources/assets/js/prototype/screens/Login.vue
+++ b/resources/assets/js/prototype/screens/Login.vue
@@ -1,5 +1,30 @@
@@ -7,13 +32,13 @@
diff --git a/routes/api.php b/routes/api.php
index 8e54864d..3b963692 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -1,5 +1,6 @@