Commit 9ce98f17 authored by Jérémie Passerat's avatar Jérémie Passerat

login (basique) ok

parent 3abe5016
......@@ -2353,6 +2353,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-eslint": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
......@@ -5378,8 +5386,7 @@
"follow-redirects": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==",
"dev": true
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
},
"for-in": {
"version": "1.0.2",
......
......@@ -8,6 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5",
"jquery": "^3.6.0",
"jquery-ui-bundle": "^1.12.1-migrate",
......
......@@ -2,12 +2,12 @@
<div>
<Login v-show="etat === 'unlogged'" @user_logged="setLogged"></Login>
<Menu v-show="etat !== 'unlogged'" v-bind:etat="etat" v-bind:isNotif="isNotif" v-bind:variante="variante" @menu_choisi="changerPage"></Menu>
<Menu v-show="etat !== 'unlogged'" v-bind:auteur="auteur" v-bind:etat="etat" v-bind:isNotif="isNotif" v-bind:variante="variante" @menu_choisi="changerPage"></Menu>
<Contenu v-show="etat === 'Contenu'" @choix_variante="choixVariante" @publication="publication"></Contenu>
<Maj v-show="etat === 'Mises à jour'" v-bind:contenuEnPublication="contenuEnPublication" ></Maj>
<Profil v-show="etat === 'Profil'" ></Profil>
<Tags v-show="etat === 'Tags'" ></Tags>
<p style="text-align: center" v-show="errorLogin">Login ou mot de passe erroné</p>
</div>
</template>
......@@ -27,13 +27,22 @@ export default {
etat: "unlogged",
variante: false,
contenuEnPublication: "",
isNotif: false
isNotif: false,
errorLogin: false,
auteur: ""
}
},
methods: {
setLogged: function () {
setLogged: function (event) {
//this.$cookies.set("isLogged", true)
this.etat = "Contenu"
if (event.isLogged){
this.etat = "Contenu"
this.errorLogin = false
this.auteur = event.auteur
}
else {
this.errorLogin = true
}
},
changerPage: function (event) {
if (event.choix === "Deconnexion")
......
<template>
<div id="loginForm">
<p>Trois comptes temporaires : Auteur 1, Auteur 2, Auteur 3</p>
<label for="identifiant">Identifiant</label>
<br>
<input type="text" id="identifiant" placeholder="identifiant" v-model="login" >
......@@ -19,14 +20,21 @@
</template>
<script>
import Service from '../src/service/Service'
export default {
name: "Login",
methods: {
logIn: function () {
this.$emit("user_logged", {"isLogged" : true})
let that = this
Service.login([this.login, this.password]).then(function (response) {
if (response.data === "True"){
that.$emit("user_logged", {"isLogged" : true, "auteur": that.login})
} else {
that.$emit("user_logged", {"isLogged" : false})
}
})
}
},
data: function () {
......
......@@ -4,7 +4,7 @@
<Choix_Mode_Variante class="menuVariante" v-show="variante"></Choix_Mode_Variante>
<div class="notif" v-on:click="choixIconeNotification" v-show="isNotif" v-bind:style="[!variante ? {'margin-left': '90%'} : {'margin-left': '31.78%'}]"></div>
<div class="circle" v-on:click="isAffiche = !isAffiche" v-bind:style="[!isNotif ? {'margin-left': '94.75%'} : {'margin-left': '3%'}]">
Auteur 1
{{auteur}}
</div>
<div class="menu" v-show="isAffiche">
<div class="sous_menu" v-on:click="choixMenuAnnexe">Profil</div>
......@@ -26,7 +26,7 @@ export default {
isAffiche: false
}
},
props: ['etat', 'variante', 'isNotif'],
props: ['etat', 'variante', 'isNotif', 'auteur'],
methods: {
choixMenuAnnexe: function (e) {
this.$emit("menu_choisi", {choix: e.target.innerText})
......
......@@ -129,6 +129,9 @@ export default {
$('#ensemble').draggable()
},
updated() {
alert('susumesusumemayi')
},
methods: {
desactiverVolet: function () {
this.isActif = !this.isActif
......
......@@ -6,7 +6,6 @@ import VPopover from 'vue-js-popover'
Vue.config.productionTip = false
Vue.use(VPopover, { tooltip: true })
new Vue({
render: h => h(Index),
}).$mount('#app')
import axios from 'axios'
const urlBase = "http://127.0.0.1:5000/"
export default {
login(data) {
let login = data[0]
let motDePasse = data[1]
/* let reponse = ""
axios.get(urlBase + "checkUser?login=" + login + "&password=" + motDePasse).then(function (response) {
reponse = response.data
})*/
return axios.get(urlBase + "checkUser?login=" + login + "&password=" + motDePasse)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment