@enso-ui/auth 2.0.6 → 2.0.10

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/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import PasswordStrength from './src/bulma/pages/auth/components/PasswordStrength.vue';
2
+
3
+ export { PasswordStrength };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@enso-ui/auth",
3
- "version": "2.0.6",
3
+ "version": "2.0.10",
4
4
  "description": "UI auth package",
5
- "main": "src/bulma/pages/auth/Index.vue",
5
+ "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <core-auth #default="{ guestState }">
3
- <section class="hero is-fullheight is-primary is-bold">
4
- <div class="hero-body">
5
- <div class="container">
2
+ <section class="hero is-fullheight is-primary is-bold">
3
+ <div class="hero-body">
4
+ <div class="container">
5
+ <core-auth v-slot="{ guestState }">
6
6
  <router v-if="guestState"/>
7
- </div>
7
+ </core-auth>
8
8
  </div>
9
- </section>
10
- </core-auth>
9
+ </div>
10
+ </section>
11
11
  </template>
12
12
 
13
13
  <script>
@@ -52,14 +52,10 @@ export default {
52
52
  methods: {
53
53
  ...mapMutations('auth', ['login']),
54
54
  ...mapMutations('layout', ['home']),
55
- ...mapMutations(['setShowQuote', 'setCsrfToken']),
56
- init(data) {
55
+ ...mapMutations(['setShowQuote']),
56
+ init() {
57
57
  this.setShowQuote(this.meta.showQuote);
58
58
 
59
- if (data.csrfToken) {
60
- this.setCsrfToken(data.csrfToken);
61
- }
62
-
63
59
  setTimeout(() => {
64
60
  this.login();
65
61
  this.home(true);
@@ -23,7 +23,7 @@ export default {
23
23
 
24
24
  components: { Fa },
25
25
 
26
- inject: ['errors', 'i18n', 'route', 'state', 'toastr'],
26
+ inject: ['errors', 'http', 'i18n', 'route', 'state', 'toastr'],
27
27
 
28
28
  props: {
29
29
  action: {
@@ -65,7 +65,7 @@ export default {
65
65
  this.state.successful = false;
66
66
  this.$emit('submitting');
67
67
 
68
- axios.post(this.route(this.endpoint), this.payload, this.config)
68
+ this.http.post(this.route(this.endpoint), this.payload, this.config)
69
69
  .then(({ data }) => {
70
70
  this.state.successful = true;
71
71
  this.$emit('success', data);
@@ -1,18 +1,19 @@
1
1
  <template>
2
2
  <div class="field">
3
3
  <div class="control has-icons-left has-icons-right">
4
- <input :value="value"
4
+ <input :value="modelValue"
5
5
  class="input"
6
6
  :type="meta.content"
7
7
  :class="{ 'is-danger': errors.has('password'), 'is-success': successful }"
8
8
  :placeholder="i18n('Repeat Password')"
9
- @input="$emit('input', $event.target.value); errors.clear('password')">
9
+ @input="$emit('update:modelValue', $event.target.modelValue);
10
+ errors.clear('password')">
10
11
  <span class="icon is-small is-left">
11
12
  <fa icon="lock"/>
12
13
  </span>
13
14
  <reveal-password :meta="meta"
14
15
  :class="{ 'mr-5': match || successful || errors.has('password')}"
15
- v-if="value && !successful"/>
16
+ v-if="modelValue && !successful"/>
16
17
  <span v-if="errors.has('password')"
17
18
  class="icon is-small is-right has-text-danger">
18
19
  <fa icon="exclamation-triangle"/>
@@ -52,12 +53,14 @@ export default {
52
53
  type: Boolean,
53
54
  required: true,
54
55
  },
55
- value: {
56
+ modelValue: {
56
57
  type: String,
57
58
  required: true,
58
59
  },
59
60
  },
60
61
 
62
+ emits: ['update:modelValue'],
63
+
61
64
  data: () => ({
62
65
  meta: {
63
66
  content: 'password',
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div class="field">
3
3
  <div class="control has-icons-left has-icons-right">
4
- <input :value="value"
4
+ <input :value="modelValue"
5
5
  v-focus
6
6
  class="input"
7
7
  type="email"
8
8
  :class="{ 'is-danger': errors.has('email'), 'is-success': successful }"
9
9
  :placeholder="i18n('Email')"
10
10
  autocomplete="email"
11
- @input="$emit('input', $event.target.value); errors.clear('email')">
11
+ @input="$emit('update:modelValue', $event.target.value); errors.clear('email')">
12
12
  <span class="icon is-small is-left">
13
13
  <fa icon="envelope"/>
14
14
  </span>
@@ -46,12 +46,14 @@ export default {
46
46
  inject: ['errors', 'i18n', 'state'],
47
47
 
48
48
  props: {
49
- value: {
49
+ modelValue: {
50
50
  type: String,
51
51
  required: true,
52
52
  },
53
53
  },
54
54
 
55
+ emits: ['change', 'update:modelValue'],
56
+
55
57
  computed: {
56
58
  successful() {
57
59
  return this.state.successful;
@@ -1,19 +1,19 @@
1
1
  <template>
2
2
  <div class="field">
3
3
  <div class="control has-icons-left has-icons-right">
4
- <input :value="value"
4
+ <input :value="modelValue"
5
5
  class="input"
6
6
  :type="meta.content"
7
7
  :class="{ 'is-danger': errors.has('password'), 'is-success': successful }"
8
8
  :placeholder="i18n('Password')"
9
9
  :autocomplete="autocomplete"
10
- @input="$emit('input', $event.target.value); errors.clear('password')">
10
+ @input="$emit('update:modelValue', $event.target.value); errors.clear('password')">
11
11
  <span class="icon is-small is-left">
12
12
  <fa icon="lock"/>
13
13
  </span>
14
14
  <reveal-password :meta="meta"
15
15
  :class="{ 'is-spaced': successful || errors.has('password') }"
16
- v-if="value && !successful"/>
16
+ v-if="modelValue && !successful"/>
17
17
  <span v-if="successful"
18
18
  class="icon is-small is-right has-text-success">
19
19
  <fa icon="check"/>
@@ -23,8 +23,8 @@
23
23
  <fa icon="exclamation-triangle"/>
24
24
  </span>
25
25
  <slot name="password-strength"
26
- :password="value"
27
- :has-password="value.length > 0"/>
26
+ :password="modelValue"
27
+ :has-password="modelValue.length > 0"/>
28
28
  </div>
29
29
  <p class="has-text-danger is-size-7"
30
30
  v-if="errors.has('password')">
@@ -56,12 +56,14 @@ export default {
56
56
  type: String,
57
57
  default: 'current-password',
58
58
  },
59
- value: {
59
+ modelValue: {
60
60
  type: String,
61
61
  required: true,
62
62
  },
63
63
  },
64
64
 
65
+ emits: ['update:modelValue'],
66
+
65
67
  data: () => ({
66
68
  meta: {
67
69
  content: 'password',
@@ -2,9 +2,9 @@
2
2
  <div class="field">
3
3
  <div class="control">
4
4
  <label class="checkbox">
5
- <input :value="value"
6
- @change="$emit('input', !value)"
7
- :checked="value"
5
+ <input :value="modelValue"
6
+ @change="$emit('update:modelValue', !modelValue)"
7
+ :checked="modelValue"
8
8
  type="checkbox">
9
9
  {{ i18n('Remember me') }}
10
10
  </label>
@@ -19,10 +19,12 @@ export default {
19
19
  inject: ['i18n'],
20
20
 
21
21
  props: {
22
- value: {
22
+ modelValue: {
23
23
  type: Boolean,
24
24
  required: true,
25
25
  },
26
26
  },
27
+
28
+ emits: ['update:modelValue'],
27
29
  };
28
30
  </script>
package/src/store/auth.js CHANGED
@@ -1,3 +1,4 @@
1
+ import axios from 'axios';
1
2
  import router from '@enso-ui/ui/src/core/services/router';
2
3
 
3
4
  export const state = {