diff --git a/cshub-client/.env.production b/cshub-client/.env.production
index 50df19ce..128253c2 100644
--- a/cshub-client/.env.production
+++ b/cshub-client/.env.production
@@ -1,2 +1,2 @@
-VUE_APP_API_URL=https://api-dev.cshub.nl
+VUE_APP_API_URL=https://api.cshub.nl
VUE_APP_DEBUG=false
diff --git a/cshub-client/package-lock.json b/cshub-client/package-lock.json
index da9a34b0..bc6d07a1 100644
--- a/cshub-client/package-lock.json
+++ b/cshub-client/package-lock.json
@@ -4301,14 +4301,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -4323,20 +4321,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -4453,8 +4448,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"ini": {
"version": "1.3.5",
@@ -4466,7 +4460,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -4481,7 +4474,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -4489,14 +4481,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -4515,7 +4505,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -4596,8 +4585,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -4609,7 +4597,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"wrappy": "1"
}
@@ -4731,7 +4718,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
diff --git a/cshub-client/public/assets/defaultAvatar.png b/cshub-client/public/assets/defaultAvatar.png
new file mode 100644
index 00000000..62ede756
Binary files /dev/null and b/cshub-client/public/assets/defaultAvatar.png differ
diff --git a/cshub-client/src/App.vue b/cshub-client/src/App.vue
index 52cdc4c3..aa309bac 100644
--- a/cshub-client/src/App.vue
+++ b/cshub-client/src/App.vue
@@ -124,6 +124,10 @@
background: white;
}
+ .postTile .v-list__tile {
+ height: auto !important;
+ }
+
.v-icon {
font-size: 17px !important;
}
diff --git a/cshub-client/src/components/admin/UserTable.vue b/cshub-client/src/components/admin/UserTable.vue
index 64185e3c..0160cc6c 100644
--- a/cshub-client/src/components/admin/UserTable.vue
+++ b/cshub-client/src/components/admin/UserTable.vue
@@ -14,7 +14,6 @@
{{ props.item.lastname }} |
{{ props.item.email }} |
{{ props.item.admin }} |
- {{ props.item.avatar }} |
{{ props.item.blocked }} |
{{ props.item.verified }} |
@@ -47,7 +46,6 @@
{text: "Last name", value: "lastname"},
{text: "Email", value: "email"},
{text: "Admin", value: "admin"},
- {text: "Avatar", value: "avatar"},
{text: "Blocked", value: "blocked"},
{text: "Verified", value: "verified"}
];
diff --git a/cshub-client/src/components/global/NavDrawer.vue b/cshub-client/src/components/global/NavDrawer.vue
index 7fa3db39..903f5a3b 100644
--- a/cshub-client/src/components/global/NavDrawer.vue
+++ b/cshub-client/src/components/global/NavDrawer.vue
@@ -21,6 +21,7 @@
+
@@ -191,6 +193,17 @@
});
});
}
+
+ /**
+ * Methods
+ */
+ private logout() {
+ logStringConsole("Logging user out");
+ document.cookie = "token=";
+ userState.clearUserModel();
+ uiState.setDrawerState(false);
+ this.$router.push(Routes.INDEX);
+ }
}
diff --git a/cshub-client/src/components/posts/Post.vue b/cshub-client/src/components/posts/Post.vue
index 6da7b464..b1056c83 100644
--- a/cshub-client/src/components/posts/Post.vue
+++ b/cshub-client/src/components/posts/Post.vue
@@ -5,107 +5,93 @@
-
-
-
-
-
- fas fa-angle-down
+
+
+
+
+ fas fa-chevron-left
-
-
-
-
-
-
- fas fa-chevron-left
-
-
- {{item.name}}
-
-
- {{post.title}}
-
-
- fas fa-check
-
-
- fas fa-edit
-
-
- fas fa-save
+
+ fas fa-angle-down
-
- fas fa-list-ol
-
-
- fas fa-angle-up
-
-
-
-
- {{post.upvotes}}
-
-
-
-
-
-
{{post.title}}
(unverified)
-
{{post.author.firstname}} {{post.author.lastname}} - {{post.datetime | formatDate}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- View
-
-
-
+
+
+
+
+
+ fas fa-chevron-left
+
+
+ {{item.name}}
+
+ {{post.title}}
+
+ fas fa-check
+
+
+ fas fa-edit
+
+
+ fas fa-save
+
+
+ fas fa-list-ol
+
+
+ fas fa-angle-up
+
+
+
+
+
+
+
+
+
+ {{post.title}}
+ {{post.author.firstname}} {{post.author.lastname}} - {{post.datetime | formatDate}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ style="width: 100%; margin: 10% auto;" />
-
+
+ clearTimeout(timeOut);
+ this.loadingIcon = false;
-
\ No newline at end of file
diff --git a/cshub-client/src/components/posts/PostEditsDialog.vue b/cshub-client/src/components/posts/PostEditsDialog.vue
index b40f3f9d..4a1c6c62 100644
--- a/cshub-client/src/components/posts/PostEditsDialog.vue
+++ b/cshub-client/src/components/posts/PostEditsDialog.vue
@@ -1,5 +1,5 @@
-
+
@@ -91,12 +91,16 @@
}
+ get thisDialogActive(): boolean {
+ return this.dialogActive.on && this.dialogActive.hash === this.postHash;
+ }
+
/**
* Watchers
*/
@Watch("dialogActive")
- private dialogActiveChanged(newVal: boolean) {
- if (newVal && this.dialogActive.hash === this.postHash) {
+ private dialogActiveChanged(newVal: editDialogType) {
+ if (this.thisDialogActive) {
ApiWrapper.sendPostRequest(new GetEditContent(this.postHash), (callbackData: GetEditContentCallback) => {
let previousDelta = new Delta(JSON.parse(JSON.stringify(callbackData.edits[0].content)));
diff --git a/cshub-client/src/components/quill/Quill.vue b/cshub-client/src/components/quill/Quill.vue
index 0b1d7671..bb8325f0 100644
--- a/cshub-client/src/components/quill/Quill.vue
+++ b/cshub-client/src/components/quill/Quill.vue
@@ -147,7 +147,6 @@
import {mathquill4quill} from "../../plugins/quill/mathquill4quill.min";
import {ImageResize} from "../../plugins/quill/ImageResize.min";
- import {QuillOptionsStatic, Sources} from "../../plugins/quill/quill";
import defaultOptions from "./QuillDefaultOptions";
import {IQuillEditSetup} from "./IQuillEditSetup";
@@ -181,7 +180,7 @@
@Prop({type: null, required: true, default: {allowEdit: true, showToolbar: true, postHash: -1}}) private editorSetup: IQuillEditSetup;
private editor: any = null;
- private editorOptions: QuillOptionsStatic = defaultOptions;
+ private editorOptions: any = defaultOptions;
private typingTimeout: number = null;
private draftValue: Delta = null;
@@ -324,7 +323,7 @@
this.editor.on("text-change", this.textChanged);
}
- private textChanged(delta: Delta, oldContents: Delta, source: Sources) {
+ private textChanged(delta: Delta, oldContents: Delta, source: any) {
clearTimeout(this.typingTimeout);
this.typingTimeout = setTimeout(() => {
localForage.setItem(this.postHashCacheItemID, this.getDelta())
diff --git a/cshub-client/src/plugins/quill/quill.ts b/cshub-client/src/plugins/quill/quill.ts
deleted file mode 100644
index b27b9de4..00000000
--- a/cshub-client/src/plugins/quill/quill.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-// Type definitions for Quill 2.0
-// Project: https://github.com/quilljs/quill/
-// Definitions by: Sumit
-// Guillaume
-// James Garbutt
-// Aniello Falcone
-// Mohammad Hossein Amri
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-// TypeScript Version: 2.9
-
-import Delta from "quill-delta";
-
-/**
- * A stricter type definition would be:
- *
- * type DeltaOperation ({ insert: any } | { delete: number } | { retain: number }) & OptionalAttributes;
- *
- * But this would break a lot of existing code as it would require manual discrimination of the union types.
- */
-export type Sources = "api" | "user" | "silent";
-
-export interface StringMap {
- [key: string]: any;
-}
-
-export interface OptionalAttributes {
- attributes?: StringMap;
-}
-
-export type TextChangeHandler = (delta: Delta, oldContents: Delta, source: Sources) => any;
-export type SelectionChangeHandler = (range: RangeStatic, oldRange: RangeStatic, source: Sources) => any;
-export type EditorChangeHandler = ((name: "text-change", delta: Delta, oldContents: Delta, source: Sources) => any)
- | ((name: "selection-change", range: RangeStatic, oldRange: RangeStatic, source: Sources) => any);
-
-export interface QuillOptionsStatic {
- debug?: string | boolean;
- modules?: StringMap;
- placeholder?: string;
- readOnly?: boolean;
- theme?: string;
- formats?: string[];
- bounds?: HTMLElement | string;
- scrollingContainer?: HTMLElement | string;
- strict?: boolean;
-}
-
-export interface RangeStatic {
- index: number;
- length: number;
-}
-
-export class RangeStatic implements RangeStatic {
- constructor() {};
-
- index: number;
- length: number;
-}
-
-export interface EventEmitter {
- on(eventName: "text-change", handler: TextChangeHandler): EventEmitter;
-
- on(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter;
-
- on(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter;
-
- once(eventName: "text-change", handler: TextChangeHandler): EventEmitter;
-
- once(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter;
-
- once(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter;
-
- off(eventName: "text-change", handler: TextChangeHandler): EventEmitter;
-
- off(eventName: "selection-change", handler: SelectionChangeHandler): EventEmitter;
-
- off(eventName: "editor-change", handler: EditorChangeHandler): EventEmitter;
-}
\ No newline at end of file
diff --git a/cshub-client/src/utilities/validation.ts b/cshub-client/src/utilities/validation.ts
index b4777f0f..e4e907fc 100644
--- a/cshub-client/src/utilities/validation.ts
+++ b/cshub-client/src/utilities/validation.ts
@@ -3,11 +3,15 @@ import VeeValidate from "vee-validate";
export const emailValidator = {
getMessage() {
- return "No correct email format.";
+ return "Use your e-mail, not NetID (e.g. C.S.Hub@student.tudelft.nl)";
},
validate(value: string) {
const regex = new RegExp("^[a-zA-Z.]*$");
- return regex.test(value);
+ if (regex.test(value) && value.includes(".") && value[value.length - 1] !== ".") {
+ return true;
+ } else {
+ return false;
+ }
}
};
diff --git a/cshub-client/src/views/posts/TopicCreate.vue b/cshub-client/src/views/posts/TopicCreate.vue
index 19d71fea..b7e15df9 100644
--- a/cshub-client/src/views/posts/TopicCreate.vue
+++ b/cshub-client/src/views/posts/TopicCreate.vue
@@ -23,7 +23,7 @@
label="Topic title"
box
v-model="topicTitle"
- v-validate="'required|min:4|max:127'"
+ v-validate="'required|min:2|max:35'"
:error-messages="errors.collect('topicTitle') + topicTitleError"
@change="topicTitleError = ''"
name="topicTitle"
diff --git a/cshub-client/src/views/router/router.ts b/cshub-client/src/views/router/router.ts
index e59c7bfc..4b1ef7a8 100644
--- a/cshub-client/src/views/router/router.ts
+++ b/cshub-client/src/views/router/router.ts
@@ -113,7 +113,6 @@ const router = new Router({
});
router.beforeEach((to: Route, from: Route, next) => {
- next();
if (!userState.hasCheckedToken) {
ApiWrapper.sendGetRequest(new VerifyUserToken(), (verified: VerifyUserTokenCallback) => {
@@ -128,11 +127,15 @@ router.beforeEach((to: Route, from: Route, next) => {
} else {
logStringConsole("User is not logged in", "isLoggedIn after API");
}
+ next();
userState.setCheckedToken();
}, (err: AxiosError) => {
dataState.setConnection(false);
+ next();
});
+ } else {
+ next();
}
});
diff --git a/cshub-client/src/views/user/CreateUserAccount.vue b/cshub-client/src/views/user/CreateUserAccount.vue
index da2ac7aa..52c8f93e 100644
--- a/cshub-client/src/views/user/CreateUserAccount.vue
+++ b/cshub-client/src/views/user/CreateUserAccount.vue
@@ -7,70 +7,72 @@
Create account
-
- (userData.passwordvisible = !userData.passwordvisible)"
- :type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8|confirmed:password confirmation'"
- box
- required
- @change="userData.passworderror = ''"
- @keyup.enter="doCreateAccount"
- >
- (userData.passwordvisible = !userData.passwordvisible)"
- :type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8'"
- box
- ref="password confirmation"
- required
- @change="userData.passworderror = ''"
- @keyup.enter="doCreateAccount"
- >
-
-
-
- Create account
-
+
+
+ (userData.passwordvisible = !userData.passwordvisible)"
+ :type="userData.passwordvisible ? 'text' : 'password'"
+ v-validate="'required|min:8|confirmed:password confirmation'"
+ box
+ required
+ @change="userData.passworderror = ''"
+ @keyup.enter="doCreateAccount"
+ >
+ (userData.passwordvisible = !userData.passwordvisible)"
+ :type="userData.passwordvisible ? 'text' : 'password'"
+ v-validate="'required|min:8'"
+ box
+ ref="password confirmation"
+ required
+ @change="userData.passworderror = ''"
+ @keyup.enter="doCreateAccount"
+ >
+
+
+
+ Create account
+
+
diff --git a/cshub-client/src/views/user/LoginScreen.vue b/cshub-client/src/views/user/LoginScreen.vue
index 9525211b..ec832535 100644
--- a/cshub-client/src/views/user/LoginScreen.vue
+++ b/cshub-client/src/views/user/LoginScreen.vue
@@ -29,7 +29,7 @@
:append-icon="userData.passwordvisible ? 'fa-eye-slash' : 'fas fa-eye'"
@click:append="() => (userData.passwordvisible = !userData.passwordvisible)"
:type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8'"
+ v-validate="'required'"
box
required
autocomplete="current-password"
diff --git a/cshub-client/src/views/user/UserDashboard.vue b/cshub-client/src/views/user/UserDashboard.vue
index 37565f8f..9b278f77 100644
--- a/cshub-client/src/views/user/UserDashboard.vue
+++ b/cshub-client/src/views/user/UserDashboard.vue
@@ -1,5 +1,11 @@
+
+ Your posts
+
+
+
+
Your profile
@@ -7,101 +13,125 @@
-
-
-
- (userData.passwordvisible = !userData.passwordvisible)"
- :type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8'"
- box
- required
- autocomplete="current-password"
- @change="userData.currentPasswordError = ''"
- @keyup.enter="changePassword"
- >
- (userData.passwordvisible = !userData.passwordvisible)"
- :type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8|confirmed:new password confirmation'"
- box
- autocomplete="new-password"
- required
- @keyup.enter="changePassword"
- >
- (userData.passwordvisible = !userData.passwordvisible)"
- :type="userData.passwordvisible ? 'text' : 'password'"
- v-validate="'required|min:8'"
- box
- required
- autocomplete="new-password"
- ref="new password confirmation"
- @keyup.enter="changePassword"
- >
- Change password
+
+
+
+
+
+
+
+
+
+ (userData.passwordvisible = !userData.passwordvisible)"
+ :type="userData.passwordvisible ? 'text' : 'password'"
+ v-validate="'required|min:8'"
+ box
+ required
+ autocomplete="current-password"
+ @change="userData.currentPasswordError = ''"
+ @keyup.enter="changePassword"
+ >
+ (userData.passwordvisible = !userData.passwordvisible)"
+ :type="userData.passwordvisible ? 'text' : 'password'"
+ v-validate="'required|min:8|confirmed:new password confirmation'"
+ box
+ autocomplete="new-password"
+ required
+ @keyup.enter="changePassword"
+ >
+ (userData.passwordvisible = !userData.passwordvisible)"
+ :type="userData.passwordvisible ? 'text' : 'password'"
+ v-validate="'required|min:8'"
+ box
+ required
+ autocomplete="new-password"
+ ref="new password confirmation"
+ @keyup.enter="changePassword"
+ >
+ Change password
+
+
+
+
+
+
+
+ Change avatar
+
+
-
-
- Your posts
-
-
-