-
{{ msg }}
-
- You’ve successfully created a project with
- Vite +
- Vue 3.
-
+
+
+
+
+
+
+
+
+
+ Register
+ Login
-
+ async register() {
+ const url = `${this.apiBaseUrl}/register`;
+ const requestOptions = {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify(this.form),
+ };
+
+ await fetch(url, requestOptions)
+ .then((response) => response.json())
+ .then((data) => console.log(data));
+ },
+ },
+};
+
+
diff --git a/frontend/src/components/ListSecrets.vue b/frontend/src/components/ListSecrets.vue
new file mode 100644
index 0000000..36d0c00
--- /dev/null
+++ b/frontend/src/components/ListSecrets.vue
@@ -0,0 +1,13 @@
+
+
+
+
+
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 0ac3a5f..bd87d63 100644
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -3,4 +3,10 @@ import './assets/main.css'
import { createApp } from 'vue'
import App from './App.vue'
-createApp(App).mount('#app')
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+
+
+const app = createApp(App)
+app.use(ElementPlus)
+app.mount('#app')
diff --git a/main.py b/main.py
index 75d0d2f..f02364f 100644
--- a/main.py
+++ b/main.py
@@ -1,6 +1,6 @@
import json
-from fastapi import Depends, FastAPI, HTTPException
+from fastapi import Depends, FastAPI, HTTPException, status
from fastapi.encoders import jsonable_encoder
from fastapi.middleware.cors import CORSMiddleware
from fastapi.security import OAuth2PasswordBearer
@@ -92,13 +92,19 @@ async def login(user: UserLogin):
cur_user = [i for i in users if i['username']==user.username]
if not cur_user:
- return {'message': "username or password is incorrect"}
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="username or password is incorrect"
+ )
else:
cur_user = cur_user[0]
password_match = Hasher.verify_password(user.password, cur_user['password'])
if not password_match:
- return {'message': "username or password is incorrect"}
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="username or password is incorrect"
+ )
encrypted_encryption_key = cur_user['encryption_key'].encode()
salt = deserialize_into_bytes(cur_user['salt'])