Skip to content

Commit

Permalink
Merge pull request #12 from philippebeck/dev
Browse files Browse the repository at this point in the history
Release 0.7.0
  • Loading branch information
philippebeck authored Feb 2, 2023
2 parents 57d6fac + 949783b commit 55d94de
Show file tree
Hide file tree
Showing 23 changed files with 576 additions and 220 deletions.
8 changes: 7 additions & 1 deletion api/controller/PostCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ exports.updatePost = (req, res, next) => {
)
}

let usersLiked = fields.usersLiked.split(",");

if (usersLiked[0] === "") {
usersLiked.shift();
}

let post = this.getPost(
fields.title,
fields.text,
Expand All @@ -169,7 +175,7 @@ exports.updatePost = (req, res, next) => {
fields.created,
fields.updated,
fields.likes,
fields.usersLiked
usersLiked
);

PostModel
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vesan",
"version": "0.6.0",
"version": "0.7.0",
"description": "CMS with Vue-Elt, Servidio, Animadio & NemJS",
"keywords": [
"cms",
Expand Down Expand Up @@ -30,7 +30,7 @@
"core-js": "^3.8.3",
"servidio": "^0.4.1",
"vue": "^3.2.45",
"vue-elt": "^0.6.4",
"vue-elt": "^0.6.5",
"vue-router": "^4.1.6"
},
"devDependencies": {
Expand Down
71 changes: 71 additions & 0 deletions src/components/connectors/ForgotPass.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<template>
<form>
<!-- User Email -->
<FieldElt id="email"
v-model:value="email"
info="Indicate your Email"
@keyup.enter="forgotPass()"
type="email"
required>
<template #legend>
Email
</template>
<template #label>
This email must have been registered before
</template>
</FieldElt>

<!-- Security -->
<div id="recaptcha"
class="g-recaptcha"
data-sitekey="">
</div>

<!-- Send Password Button -->
<BtnElt type="button"
content="Send"
@click="forgotPass()"
class="btn-orange">
<template #btn>
<i class="fa-regular fa-paper-plane fa-lg"></i>
</template>
</BtnElt>
</form>
</template>

<script>
import constants from "/constants";
export default {
name: "ForgotPass",
data() {
return {
email: ""
}
},
methods: {
/**
* FORGOT PASSWORD
*/
forgotPass() {
if (this.$serve.checkEmail(this.email) &&
confirm(constants.FORGOT_CONFIRM)) {
let message = new FormData();
message.append("email", this.email);
message.append("subject", constants.FORGOT_SUBJECT);
message.append("text", constants.FORGOT_TEXT);
this.$serve.postData("/api/users/forgot", message)
.then(() => {
alert(message.get("subject") + " sended !");
this.$router.push("/login");
})
.catch(err => { console.log(err) });
}
}
}
}
</script>
88 changes: 88 additions & 0 deletions src/components/connectors/SignIn.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<form class="form">

<!-- User Email -->
<FieldElt id="email"
v-model:value="email"
info="Indicate your Email"
@keyup.enter="login()"
type="email">
<template #legend>
Email
</template>
<template #label>
This email must have been registered before
</template>
</FieldElt>

<!-- User Pass -->
<FieldElt id="pass"
v-model:value="pass"
info="Indicate your Password"
@keyup.enter="login()"
type="password">
<template #legend>
Password
</template>
<template #label>
You can use the Forgot Password feature if needed
</template>
</FieldElt>

<!-- Security -->
<div id="recaptcha"
class="g-recaptcha"
data-sitekey="">
</div>

<!-- Login Button -->
<BtnElt type="button"
content="Enter"
@click="login()"
class="btn-green">
<template #btn>
<i class="fa-solid fa-right-to-bracket fa-lg"></i>
</template>
</BtnElt>
</form>
</template>

<script>
export default {
name: "SignIn",
data() {
return {
email: "",
pass: ""
}
},
methods: {
/**
* USER LOGIN
*/
login() {
if (this.$serve.checkEmail(this.email) &&
this.$serve.checkPass(this.pass)) {
let auth = new FormData();
auth.append("email", this.email);
auth.append("pass", this.pass);
this.$serve.postData("/api/users/login", auth)
.then((res) => {
let token = JSON.stringify(res.token);
let userId = JSON.stringify(res.userId);
localStorage.setItem("userToken", token);
localStorage.setItem("userId", userId);
this.$router.go("/");
})
.catch(err => { console.log(err) });
}
}
}
}
</script>
9 changes: 9 additions & 0 deletions src/components/connectors/SignUp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<template>
<h1>SignUp</h1>
</template>

<script>
export default {
name: "ForgotPass"
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@
<BtnElt type="button"
content="Create"
@click="validateNewArticle()"
class="btn-green"/>
class="btn-green"
title="Create a new Article">
<template #btn>
<i class="fa-solid fa-square-plus fa-lg"></i>
</template>
</BtnElt>
</form>
</template>
</CardElt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
<BtnElt type="button"
content="Create"
@click="createComment()"
class="btn-green"/>
class="btn-green"
title="Create a new Comment">
<template #btn>
<i class="fa-solid fa-square-plus fa-lg"></i>
</template>
</BtnElt>
</form>
</template>
</CardElt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@
<BtnElt type="button"
content="Create"
@click="validateNewPost()"
class="btn-green"/>
class="btn-green"
title="Create a new Post">
<template #btn>
<i class="fa-solid fa-square-plus fa-lg"></i>
</template>
</BtnElt>
</form>
</template>
</CardElt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
<BtnElt type="button"
content="Create"
@click="createReview()"
class="btn-green"/>
class="btn-green"
title="Create a new Review">
<template #btn>
<i class="fa-solid fa-square-plus fa-lg"></i>
</template>
</BtnElt>
</form>
</template>
</CardElt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@
<BtnElt type="button"
content="Create"
@click="validateNewUser()"
class="btn-green"/>
class="btn-green"
title="Create a new User">
<template #btn>
<i class="fa-solid fa-square-plus fa-lg"></i>
</template>
</BtnElt>
</form>
</template>
</CardElt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

<!-- Article Id -->
<template #cell-_id="slotProps">
{{ slotProps.index + 1 }}
<b>#{{ slotProps.index + 1 }}</b>
({{ articles[slotProps.index]._id }})
</template>

<!-- Article Name -->
Expand Down Expand Up @@ -87,12 +88,12 @@

<!-- Article Created -->
<template #cell-created="slotProps">
{{ new Date(getArticles()[slotProps.index].created).toLocaleString() }}
{{ new Date(articles[slotProps.index].created).toLocaleString() }}
</template>

<!-- Article Updated -->
<template #cell-updated="slotProps">
{{ new Date(getArticles()[slotProps.index].updated).toLocaleString() }}
{{ new Date(articles[slotProps.index].updated).toLocaleString() }}
</template>

<template #body="slotProps">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@

<!-- Comment Id -->
<template #cell-_id="slotProps">
{{ slotProps.index + 1 }}
<b>#{{ slotProps.index + 1 }}</b>
({{ comments[slotProps.index]._id }})
</template>

<!-- Comment Text -->
Expand All @@ -57,22 +58,24 @@

<!-- Comment Post -->
<template #cell-post="slotProps">
{{ getCommentPost(getComments()[slotProps.index].post) }}
<b>{{ getCommentPost(comments[slotProps.index].post) }}</b>
({{ comments[slotProps.index].post }})
</template>

<!-- Comment User -->
<template #cell-user="slotProps">
{{ getCommentUser(getComments()[slotProps.index].user) }}
<b>{{ getCommentUser(comments[slotProps.index].user) }}</b>
({{ comments[slotProps.index].user }})
</template>

<!-- Comment Created -->
<template #cell-created="slotProps">
{{ new Date(getComments()[slotProps.index].created).toLocaleString() }}
{{ new Date(comments[slotProps.index].created).toLocaleString() }}
</template>

<!-- Comment Updated -->
<template #cell-updated="slotProps">
{{ new Date(getComments()[slotProps.index].updated).toLocaleString() }}
{{ new Date(comments[slotProps.index].updated).toLocaleString() }}
</template>

<template #body="slotProps">
Expand Down
Loading

0 comments on commit 55d94de

Please sign in to comment.