diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b857463..334c89a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1382,6 +1382,11 @@ "@types/node": "*" } }, + "@types/cookie": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", + "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" + }, "@types/express": { "version": "4.17.11", "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.11.tgz", @@ -3103,6 +3108,14 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -4563,8 +4576,7 @@ "cookie": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", - "dev": true + "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" }, "cookie-signature": { "version": "1.0.6", @@ -7238,8 +7250,7 @@ "follow-redirects": { "version": "1.13.3", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", - "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==", - "dev": true + "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==" }, "for-in": { "version": "1.0.2", @@ -13088,6 +13099,18 @@ "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "request-progress": { @@ -13117,6 +13140,18 @@ "request-promise-core": "1.1.4", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" + }, + "dependencies": { + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } } }, "require-directory": { @@ -14683,16 +14718,6 @@ "integrity": "sha1-riF2gXXRVZ1IvvNUILL0li8JwzA=", "dev": true }, - "tough-cookie": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dev": true, - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, "tr46": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", @@ -15024,6 +15049,15 @@ "imurmurhash": "^0.1.4" } }, + "universal-cookie": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", + "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", + "requires": { + "@types/cookie": "^0.3.3", + "cookie": "^0.4.0" + } + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index 11d60b3..4c8f8cc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,8 +10,10 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "axios": "^0.21.1", "core-js": "^3.6.5", "register-service-worker": "^1.7.1", + "universal-cookie": "^4.0.4", "vue": "^2.6.11", "vue-router": "^3.2.0", "vuetify": "^2.4.0", diff --git a/frontend/src/api/login.ts b/frontend/src/api/login.ts new file mode 100644 index 0000000..2150002 --- /dev/null +++ b/frontend/src/api/login.ts @@ -0,0 +1,25 @@ +import axios, { AxiosResponse } from 'axios'; +import Cookies from 'universal-cookie'; + +export default { + register: async (email: string, password: string, symbol: string): Promise => { + const cookies = new Cookies(); + const response = await axios({ + method: 'post', + url: 'http://localhost:8000/api/login', + headers: { + 'Content-Type': 'application/json', + 'X-CSRFToken': cookies.get('csrf-token'), + }, + data: { + loginName: email, + Password: password, + Symbol: symbol, + diaryUrl: 'http://cufs.fakelog.cf/', + }, + }); + + document.cookie = response.headers['Set-Cookie']; + return response; + }, +}; diff --git a/frontend/src/components/Login/SelectStudent.vue b/frontend/src/components/Login/SelectStudent.vue new file mode 100644 index 0000000..7826c1e --- /dev/null +++ b/frontend/src/components/Login/SelectStudent.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/frontend/src/components/Login/UserLogin.vue b/frontend/src/components/Login/UserLogin.vue index 6faa588..f5f8ec6 100644 --- a/frontend/src/components/Login/UserLogin.vue +++ b/frontend/src/components/Login/UserLogin.vue @@ -42,22 +42,34 @@ diff --git a/frontend/src/views/Login.vue b/frontend/src/views/Login.vue index 2f7400e..71342e7 100644 --- a/frontend/src/views/Login.vue +++ b/frontend/src/views/Login.vue @@ -5,7 +5,8 @@
- + +
@@ -15,19 +16,14 @@ diff --git a/frontend/src/views/Panel.vue b/frontend/src/views/Panel.vue new file mode 100644 index 0000000..94a7395 --- /dev/null +++ b/frontend/src/views/Panel.vue @@ -0,0 +1,13 @@ + + + + +