Commit 71a97b7b authored by Thibaut Vallee's avatar Thibaut Vallee
Browse files

oublie de logout event

parent 32e516e9
Loading
Loading
Loading
Loading
Loading
+9 −1
Changes for CHANGELOG.md: 9 added lines, 1 removed line.
Original line number Diff line number Diff line
CHANGELOG

0.0.8 (20/03/2026)
0.0.12 (20/03/2026)
------------------
- Event de logout en cas de déconnexion

0.0.11 (20/03/2026)
------------------
- Correctif sur la position des fichier de l'api

0.0.10 (20/03/2026)
------------------
- Premiére version de la lib en front

+19 −11
Changes for frontend/dist/unicaen-authentification.es.js: 19 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -4542,7 +4542,7 @@ const _hoisted_2 = {
};
const _sfc_main = {
  __name: "LoginButton",
  emits: ["authentification:success", "authentification:failure"],
  emits: ["authentification:success", "authentification:failure", "authentification:logout"],
  setup(__props, { emit: __emit }) {
    useQuasar().notify;
    const emit = __emit;
@@ -4575,6 +4575,14 @@ const _sfc_main = {
        emit("authentification:failure", authentificationStore.error);
      }
    }
    async function logout() {
      await authentificationStore.logout();
      if (!authentificationStore.error) {
        emit("authentification:logout");
      } else {
        console.error(authentificationStore.error);
      }
    }
    function resetDialog() {
      showLocalForm.value = null;
      login.value = { username: "", password: "" };
@@ -4593,25 +4601,25 @@ const _sfc_main = {
          flat: "",
          label: "Déconnexion",
          icon: "logout",
          onClick: _cache[1] || (_cache[1] = ($event) => unref(authentificationStore).logout())
          onClick: logout
        })),
        unref(authentificationStore).isAuthenticated() && unref(userStore).user ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createVNode(QBtn, {
            flat: "",
            label: labelLogged.value,
            icon: "account_circle",
            onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$router.push("/profile"))
            onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$router.push("/profile"))
          }, null, 8, ["label"])
        ])) : createCommentVNode("", true),
        createVNode(QDialog, {
          modelValue: showLoginDialog.value,
          "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => showLoginDialog.value = $event)
          "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => showLoginDialog.value = $event)
        }, {
          default: withCtx(() => [
            createVNode(QCard, { style: { "min-width": "300px" } }, {
              default: withCtx(() => [
                createVNode(QCardSection, { class: "text-h6" }, {
                  default: withCtx(() => [..._cache[9] || (_cache[9] = [
                  default: withCtx(() => [..._cache[8] || (_cache[8] = [
                    createTextVNode(" Choisissez votre mode de connexion ", -1)
                  ])]),
                  _: 1
@@ -4622,14 +4630,14 @@ const _sfc_main = {
                      outline: "",
                      color: "primary",
                      class: "full-width q-mb-sm",
                      onClick: _cache[3] || (_cache[3] = ($event) => showLocalForm.value = "login")
                      onClick: _cache[2] || (_cache[2] = ($event) => showLocalForm.value = "login")
                    }, {
                      default: withCtx(() => [
                        createVNode(QIcon, {
                          name: "person",
                          class: "q-mr-sm"
                        }),
                        _cache[10] || (_cache[10] = createTextVNode(" Connexion locale ", -1))
                        _cache[9] || (_cache[9] = createTextVNode(" Connexion locale ", -1))
                      ]),
                      _: 1
                    })
@@ -4640,17 +4648,17 @@ const _sfc_main = {
                  default: withCtx(() => [
                    createVNode(QInput, {
                      modelValue: login.value.username,
                      "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => login.value.username = $event),
                      "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => login.value.username = $event),
                      label: "Username",
                      type: "text"
                    }, null, 8, ["modelValue"]),
                    createVNode(QInput, {
                      modelValue: login.value.password,
                      "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => login.value.password = $event),
                      "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => login.value.password = $event),
                      label: "Mot de passe",
                      type: "password",
                      class: "q-mt-sm",
                      onKeyup: _cache[6] || (_cache[6] = withKeys(($event) => submitLogin(login.value.email, login.value.password), ["enter"]))
                      onKeyup: _cache[5] || (_cache[5] = withKeys(($event) => submitLogin(login.value.email, login.value.password), ["enter"]))
                    }, null, 8, ["modelValue"]),
                    errorMessage.value ? (openBlock(), createBlock(QBanner, {
                      key: 0,
@@ -4680,7 +4688,7 @@ const _sfc_main = {
                      key: 0,
                      label: "Se connecter",
                      color: "primary",
                      onClick: _cache[7] || (_cache[7] = ($event) => submitLogin(login.value.username, login.value.password))
                      onClick: _cache[6] || (_cache[6] = ($event) => submitLogin(login.value.username, login.value.password))
                    })) : createCommentVNode("", true)
                  ]),
                  _: 1
+19 −11
Changes for frontend/dist/unicaen-authentification.umd.js: 19 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -4544,7 +4544,7 @@
  };
  const _sfc_main = {
    __name: "LoginButton",
    emits: ["authentification:success", "authentification:failure"],
    emits: ["authentification:success", "authentification:failure", "authentification:logout"],
    setup(__props, { emit: __emit }) {
      useQuasar().notify;
      const emit = __emit;
@@ -4577,6 +4577,14 @@
          emit("authentification:failure", authentificationStore.error);
        }
      }
      async function logout() {
        await authentificationStore.logout();
        if (!authentificationStore.error) {
          emit("authentification:logout");
        } else {
          console.error(authentificationStore.error);
        }
      }
      function resetDialog() {
        showLocalForm.value = null;
        login.value = { username: "", password: "" };
@@ -4595,25 +4603,25 @@
            flat: "",
            label: "Déconnexion",
            icon: "logout",
            onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(authentificationStore).logout())
            onClick: logout
          })),
          vue.unref(authentificationStore).isAuthenticated() && vue.unref(userStore).user ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
            vue.createVNode(QBtn, {
              flat: "",
              label: labelLogged.value,
              icon: "account_circle",
              onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$router.push("/profile"))
              onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$router.push("/profile"))
            }, null, 8, ["label"])
          ])) : vue.createCommentVNode("", true),
          vue.createVNode(QDialog, {
            modelValue: showLoginDialog.value,
            "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => showLoginDialog.value = $event)
            "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => showLoginDialog.value = $event)
          }, {
            default: vue.withCtx(() => [
              vue.createVNode(QCard, { style: { "min-width": "300px" } }, {
                default: vue.withCtx(() => [
                  vue.createVNode(QCardSection, { class: "text-h6" }, {
                    default: vue.withCtx(() => [..._cache[9] || (_cache[9] = [
                    default: vue.withCtx(() => [..._cache[8] || (_cache[8] = [
                      vue.createTextVNode(" Choisissez votre mode de connexion ", -1)
                    ])]),
                    _: 1
@@ -4624,14 +4632,14 @@
                        outline: "",
                        color: "primary",
                        class: "full-width q-mb-sm",
                        onClick: _cache[3] || (_cache[3] = ($event) => showLocalForm.value = "login")
                        onClick: _cache[2] || (_cache[2] = ($event) => showLocalForm.value = "login")
                      }, {
                        default: vue.withCtx(() => [
                          vue.createVNode(QIcon, {
                            name: "person",
                            class: "q-mr-sm"
                          }),
                          _cache[10] || (_cache[10] = vue.createTextVNode(" Connexion locale ", -1))
                          _cache[9] || (_cache[9] = vue.createTextVNode(" Connexion locale ", -1))
                        ]),
                        _: 1
                      })
@@ -4642,17 +4650,17 @@
                    default: vue.withCtx(() => [
                      vue.createVNode(QInput, {
                        modelValue: login.value.username,
                        "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => login.value.username = $event),
                        "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => login.value.username = $event),
                        label: "Username",
                        type: "text"
                      }, null, 8, ["modelValue"]),
                      vue.createVNode(QInput, {
                        modelValue: login.value.password,
                        "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => login.value.password = $event),
                        "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => login.value.password = $event),
                        label: "Mot de passe",
                        type: "password",
                        class: "q-mt-sm",
                        onKeyup: _cache[6] || (_cache[6] = vue.withKeys(($event) => submitLogin(login.value.email, login.value.password), ["enter"]))
                        onKeyup: _cache[5] || (_cache[5] = vue.withKeys(($event) => submitLogin(login.value.email, login.value.password), ["enter"]))
                      }, null, 8, ["modelValue"]),
                      errorMessage.value ? (vue.openBlock(), vue.createBlock(QBanner, {
                        key: 0,
@@ -4682,7 +4690,7 @@
                        key: 0,
                        label: "Se connecter",
                        color: "primary",
                        onClick: _cache[7] || (_cache[7] = ($event) => submitLogin(login.value.username, login.value.password))
                        onClick: _cache[6] || (_cache[6] = ($event) => submitLogin(login.value.username, login.value.password))
                      })) : vue.createCommentVNode("", true)
                    ]),
                    _: 1
+10 −2
Changes for frontend/src/components/LoginButton.vue: 10 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
      flat label="Connexion" icon="login" @click="showLoginDialog = true" />
    <q-btn
      v-else
      flat label="Déconnexion" icon="logout" @click="authentificationStore.logout()" />
      flat label="Déconnexion" icon="logout" @click="logout" />
    <div class="column justify-center" v-if="authentificationStore.isAuthenticated() && userStore.user">
      <q-btn
        flat :label="labelLogged" icon="account_circle" @click="$router.push('/profile')">
@@ -68,7 +68,7 @@ import { useAuthentificationStore } from "../stores/authentificationStore.js";
import {useQuasar} from "quasar";
const Notify = useQuasar().notify;

const emit = defineEmits(['authentification:success', 'authentification:failure'])
const emit = defineEmits(['authentification:success', 'authentification:failure', 'authentification:logout'])


const showLoginDialog = ref(false)
@@ -106,6 +106,14 @@ async function submitLogin (username, password) {
    emit("authentification:failure", authentificationStore.error);
  }
}
async function logout () {
  await authentificationStore.logout()
  if (!authentificationStore.error) {
    emit("authentification:logout");
  } else {
      console.error(authentificationStore.error)
  }
}

// async function submitRegister () {
//   registerError.value = ''