@oniti/quasar-app-extension-vlank-auth 2.0.8 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oniti/quasar-app-extension-vlank-auth",
3
- "version": "2.0.8",
3
+ "version": "3.0.0",
4
4
  "description": "Authentification",
5
5
  "author": "François BOUYER <francois@oniti.fr>",
6
6
  "license": "MIT",
@@ -50,54 +50,49 @@
50
50
  </q-card>
51
51
  </div>
52
52
  </template>
53
+ <script setup>
54
+ import { ref, onMounted, computed, watch, inject } from 'vue'
55
+ import { useStore } from 'vuex'
56
+ import { useQuasar } from 'quasar'
53
57
 
54
- <script>
55
- import { mapState } from "vuex";
56
- import { defineComponent } from "vue";
58
+ const store = useStore()
59
+ const $q = useQuasar()
60
+ const $auth = inject('vlank-auth')
57
61
 
58
- export default defineComponent({
59
- name: "Login",
60
- data() {
61
- return {
62
- isPwd: true,
63
- login: "",
64
- password: "",
65
- };
66
- },
67
- computed: {
68
- ...mapState({
69
- has_check: (state) => state.auth.has_check,
70
- }),
71
- getUrlPasswordLost: function() {
72
- return this.$q.config.onitiVlankAuth.defaultPasswordLostRoute
73
- },
74
- },
75
- watch: {
76
- has_check(newValue, oldValue) {
77
- if (newValue) {
78
- this.$q.loading.hide();
79
- }
80
- },
81
- },
82
- mounted() {
83
- if (!this.$store.state.auth.has_check)
84
- this.$q.loading.show({
85
- delay: 0, // ms
86
- });
87
- },
88
- methods: {
89
- submitConnexion: function () {
90
- this.$auth.login({
91
- email: this.login,
92
- password: this.password,
93
- });
94
- },
62
+ const isPwd = ref(true)
63
+ const login = ref("")
64
+ const password = ref("")
95
65
 
96
- getLogoImage: function () {
97
- return require('vlank-auth-logo')
98
- }
99
- },
100
- });
66
+ const has_check = computed(() => store.state.auth.has_check)
67
+
68
+ const getUrlPasswordLost = computed(() => {
69
+ return $q.config.onitiVlankAuth.defaultPasswordLostRoute
70
+ })
71
+
72
+ const submitConnexion = function () {
73
+ $auth.login({
74
+ email: login.value,
75
+ password: password.value,
76
+ });
77
+ }
78
+
79
+ const getLogoImage = function () {
80
+ return require('vlank-auth-logo')
81
+ }
82
+
83
+ watch(has_check, (newValue, oldValue) => {
84
+ if(newValue) {
85
+ $q.loading.hide();
86
+ }
87
+ })
88
+
89
+ onMounted(() => {
90
+ if(!store.state.auth.has_check){
91
+ $q.loading.show({
92
+ delay: 0, // ms
93
+ })
94
+ }
95
+ })
101
96
  </script>
102
97
 
103
98
  <style lang="sass">
@@ -24,26 +24,25 @@
24
24
  </div>
25
25
  </template>
26
26
 
27
- <script>
28
- export default {
29
- name: 'PasswordLost',
30
- data () {
31
- return {
32
- login: ''
33
- }
34
- },
35
- methods: {
36
- submitPasswordLost: function () {
37
- this.$auth.passwordLost({
38
- email: this.login
39
- }).then(() => {
40
- this.$router.push(this.$auth.getLoginRoute())
41
- })
42
- },
43
- getLogoImage: function () {
44
- return require('vlank-auth-logo')
45
- }
46
- }
27
+ <script setup>
28
+ import { ref, inject } from 'vue'
29
+ import { useRouter } from 'vue-router'
30
+
31
+ const $auth = inject('vlank-auth')
32
+ const $router = useRouter()
33
+
34
+ const login = ref('')
35
+
36
+ const submitPasswordLost = function () {
37
+ $auth.passwordLost({
38
+ email: login.value
39
+ }).then(() => {
40
+ $router.push($auth.getLoginRoute())
41
+ })
42
+ }
43
+
44
+ const getLogoImage = function () {
45
+ return require('vlank-auth-logo')
47
46
  }
48
47
  </script>
49
48
 
@@ -51,51 +51,54 @@
51
51
  </div>
52
52
  </template>
53
53
 
54
- <script>
55
- import { mapState } from "vuex";
56
- export default {
57
- name: "PasswordReset",
58
- data() {
59
- return {
60
- isPwd: true,
61
- token: this.$route.params.token,
62
- new_password: "",
63
- password_confirm: ""
64
- };
65
- },
66
- computed: {
67
- ...mapState({
68
- has_check: (state) => state.auth.has_check,
69
- }),
70
- },
71
- watch: {
72
- has_check(newValue, oldValue) {
73
- if (newValue) {
74
- this.$q.loading.hide();
75
- }
76
- },
77
- },
78
- mounted() {
79
- if (!this.$store.state.auth.has_check)
80
- this.$q.loading.show({
81
- delay: 0, // ms
82
- });
83
- },
84
- methods: {
85
- submitPassword: function () {
86
- this.$auth.resetPassword({
87
- new_password: this.new_password,
88
- password_confirm: this.password_confirm,
89
- token: this.token
90
- }).then(()=> {
91
- this.$router.push(this.$auth.getLoginRoute())
92
- });
93
- },
94
- getLogoImage: function () {
95
- return require('vlank-auth-logo')
96
- }
97
- },
98
- };
54
+ <script setup>
55
+ import { ref, computed, watch } from 'vue'
56
+ import { useRoute, useRouter } from 'vue-router'
57
+ import { useStore } from 'vuex'
58
+ import { useQuasar } from 'quasar'
59
+
60
+ const $route = useRoute()
61
+ const $router = useRouter()
62
+ const store = useStore()
63
+ const $q = useQuasar()
64
+ const $auth = inject('vlank-auth')
65
+
66
+ const isPwd = ref(true)
67
+ const token = ref($route.params.token)
68
+ const new_password = ref("")
69
+ const password_confirm = ref("")
70
+
71
+ const has_check = computed(() => {
72
+ return store.state.auth.has_check
73
+ })
74
+
75
+ const submitPassword = function () {
76
+ $auth.resetPassword({
77
+ new_password: new_password.value,
78
+ password_confirm: password_confirm.value,
79
+ token: token.value
80
+ }).then(()=> {
81
+ $router.push($auth.getLoginRoute())
82
+ });
83
+ }
84
+
85
+ const getLogoImage = function () {
86
+ return require('vlank-auth-logo')
87
+ }
88
+
89
+ watch(has_check, (newValue, oldValue) => {
90
+ if(newValue) {
91
+ $q.loading.hide();
92
+ }
93
+ })
94
+
95
+ onMounted(() => {
96
+ if(!store.state.auth.has_check){
97
+ $q.loading.show({
98
+ delay: 0, // ms
99
+ })
100
+ }
101
+ })
99
102
  </script>
100
103
 
101
104
  <style lang="sass">