@enso-ui/auth 3.0.0 → 3.1.1
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/LICENSE +1 -1
- package/README.md +1 -1
- package/package.json +10 -24
- package/src/bulma/layouts/Auth.vue +62 -6
- package/src/bulma/pages/auth/Login.vue +24 -11
- package/src/bulma/pages/auth/components/AuthForm.vue +140 -7
- package/src/bulma/pages/auth/components/PasswordStrength.vue +2 -3
- package/src/bulma/pages/auth/components/Submit.vue +17 -8
- package/src/bulma/pages/auth/components/fields/Confirmation.vue +10 -7
- package/src/bulma/pages/auth/components/fields/Email.vue +9 -6
- package/src/bulma/pages/auth/components/fields/Password.vue +11 -8
- package/src/bulma/register.js +5 -0
- package/src/bulma/routes/auth.js +2 -3
- package/src/core/layouts/Auth.vue +11 -8
- package/src/pinia/auth.js +36 -0
- package/src/store/auth.js +0 -32
package/LICENSE
CHANGED
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enso-ui/auth",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "UI auth package",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
6
|
"repository": {
|
|
10
7
|
"type": "git",
|
|
11
8
|
"url": "git+https://github.com/enso-ui/auth.git"
|
|
@@ -15,32 +12,21 @@
|
|
|
15
12
|
"vue"
|
|
16
13
|
],
|
|
17
14
|
"author": "Adrian Ocneanu <aocneanu@gmail.com>",
|
|
18
|
-
"license": "
|
|
15
|
+
"license": "MIT",
|
|
19
16
|
"bugs": {
|
|
20
17
|
"url": "https://github.com/enso-ui/auth/issues"
|
|
21
18
|
},
|
|
22
19
|
"homepage": "https://github.com/enso-ui/auth#readme",
|
|
23
20
|
"dependencies": {
|
|
24
|
-
"@enso-ui/directives": "^
|
|
25
|
-
"@enso-ui/forms": "^
|
|
26
|
-
"@enso-ui/laravel-validation": "^
|
|
27
|
-
"@enso-ui/ui": "^
|
|
28
|
-
"@fortawesome/fontawesome-svg-core": "^
|
|
29
|
-
"@fortawesome/free-solid-svg-icons": "^
|
|
30
|
-
"@fortawesome/vue-fontawesome": "3.
|
|
21
|
+
"@enso-ui/directives": "^3.1.0",
|
|
22
|
+
"@enso-ui/forms": "^4.1.0",
|
|
23
|
+
"@enso-ui/laravel-validation": "^3.1.0",
|
|
24
|
+
"@enso-ui/ui": "^7.1.0",
|
|
25
|
+
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
26
|
+
"@fortawesome/free-solid-svg-icons": "^7.2.0",
|
|
27
|
+
"@fortawesome/vue-fontawesome": "3.1.3",
|
|
28
|
+
"pinia": "^3.0.3",
|
|
31
29
|
"vue": "^3.0",
|
|
32
|
-
"vuex": "^4.0.0",
|
|
33
30
|
"zxcvbn": "^4.4.2"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@vue/cli-plugin-babel": "5.0.0-beta.6",
|
|
37
|
-
"@vue/cli-plugin-eslint": "5.0.0-beta.6",
|
|
38
|
-
"@vue/eslint-config-airbnb": "^5.0.0",
|
|
39
|
-
"autoprefixer": "^9.6.1",
|
|
40
|
-
"babel-eslint": "^10.0.1",
|
|
41
|
-
"cross-env": "^6.0.0",
|
|
42
|
-
"eslint": "^7.0.0",
|
|
43
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
44
|
-
"eslint-plugin-vue": "^8.0.3"
|
|
45
31
|
}
|
|
46
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<section class="hero is-fullheight
|
|
3
|
-
<div class="hero-body">
|
|
4
|
-
<div class="container">
|
|
2
|
+
<section class="hero is-fullheight auth-shell">
|
|
3
|
+
<div class="hero-body auth-shell-body">
|
|
4
|
+
<div class="container auth-shell-container">
|
|
5
5
|
<core-auth v-slot="{ guestState }">
|
|
6
|
-
<router v-if="guestState"
|
|
6
|
+
<router-view v-if="guestState"
|
|
7
|
+
:key="$route.path"/>
|
|
7
8
|
</core-auth>
|
|
8
9
|
</div>
|
|
9
10
|
</div>
|
|
@@ -11,12 +12,67 @@
|
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script>
|
|
14
|
-
import Router from '@enso-ui/ui/src/bulma/pages/Router.vue';
|
|
15
15
|
import CoreAuth from '../../core/layouts/Auth.vue';
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
18
|
name: 'Auth',
|
|
19
19
|
|
|
20
|
-
components: { CoreAuth
|
|
20
|
+
components: { CoreAuth },
|
|
21
21
|
};
|
|
22
22
|
</script>
|
|
23
|
+
|
|
24
|
+
<style lang="scss">
|
|
25
|
+
.auth-shell {
|
|
26
|
+
position: relative;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
background:
|
|
29
|
+
radial-gradient(circle at 16% 18%, rgba(255, 255, 255, 0.2), transparent 26%),
|
|
30
|
+
radial-gradient(circle at 84% 14%, rgba(123, 92, 255, 0.16), transparent 28%),
|
|
31
|
+
radial-gradient(circle at 78% 74%, rgba(255, 176, 0, 0.13), transparent 24%),
|
|
32
|
+
linear-gradient(135deg, #041a2e 0%, #0c3854 32%, #0f8e96 70%, #18d2c5 100%);
|
|
33
|
+
|
|
34
|
+
&::before,
|
|
35
|
+
&::after {
|
|
36
|
+
content: '';
|
|
37
|
+
position: absolute;
|
|
38
|
+
inset: auto;
|
|
39
|
+
pointer-events: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&::before {
|
|
43
|
+
top: -12rem;
|
|
44
|
+
left: -8rem;
|
|
45
|
+
width: 34rem;
|
|
46
|
+
height: 34rem;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 66%);
|
|
49
|
+
filter: blur(14px);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&::after {
|
|
53
|
+
right: -10rem;
|
|
54
|
+
bottom: -10rem;
|
|
55
|
+
width: 38rem;
|
|
56
|
+
height: 38rem;
|
|
57
|
+
border-radius: 50%;
|
|
58
|
+
background: radial-gradient(circle, rgba(2, 12, 27, 0.42) 0%, rgba(2, 12, 27, 0) 68%);
|
|
59
|
+
filter: blur(18px);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.auth-shell-body {
|
|
64
|
+
position: relative;
|
|
65
|
+
z-index: 1;
|
|
66
|
+
min-height: 100vh;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.auth-shell-container {
|
|
70
|
+
position: relative;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@media screen and (max-width: 768px) {
|
|
74
|
+
.auth-shell-body {
|
|
75
|
+
min-height: 100vh;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|
|
@@ -9,18 +9,21 @@
|
|
|
9
9
|
<remember v-model="payload.remember"
|
|
10
10
|
v-if="!isWebview"/>
|
|
11
11
|
<template #footer>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
<div class="auth-footer is-flex is-justify-content-flex-end mt-3">
|
|
13
|
+
<router-link class="auth-footer-link is-flex is-align-items-center"
|
|
14
|
+
:to="{ name: 'password.email' }">
|
|
15
|
+
{{ i18n('Forgot password') }}
|
|
16
|
+
</router-link>
|
|
17
|
+
</div>
|
|
17
18
|
</template>
|
|
18
19
|
</auth-form>
|
|
19
20
|
</template>
|
|
20
21
|
|
|
21
22
|
<script>
|
|
22
|
-
import { mapState, mapGetters, mapMutations } from 'vuex';
|
|
23
23
|
import Errors from '@enso-ui/laravel-validation';
|
|
24
|
+
import { app } from '@enso-ui/ui/src/pinia/app';
|
|
25
|
+
import { layout } from '@enso-ui/ui/src/pinia/layout';
|
|
26
|
+
import { auth } from '../../../pinia/auth';
|
|
24
27
|
import AuthForm from './components/AuthForm.vue';
|
|
25
28
|
import Email from './components/fields/Email.vue';
|
|
26
29
|
import Password from './components/fields/Password.vue';
|
|
@@ -45,14 +48,24 @@ export default {
|
|
|
45
48
|
}),
|
|
46
49
|
|
|
47
50
|
computed: {
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
meta() {
|
|
52
|
+
return app().meta;
|
|
53
|
+
},
|
|
54
|
+
isWebview() {
|
|
55
|
+
return app().isWebview;
|
|
56
|
+
},
|
|
50
57
|
},
|
|
51
58
|
|
|
52
59
|
methods: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
login() {
|
|
61
|
+
auth().login();
|
|
62
|
+
},
|
|
63
|
+
home(value) {
|
|
64
|
+
layout().setHome(value);
|
|
65
|
+
},
|
|
66
|
+
setShowQuote(value) {
|
|
67
|
+
app().setShowQuote(value);
|
|
68
|
+
},
|
|
56
69
|
init() {
|
|
57
70
|
this.setShowQuote(this.meta.showQuote);
|
|
58
71
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="login"
|
|
3
3
|
:class="$attrs.class">
|
|
4
4
|
<div class="box p-3">
|
|
5
|
-
<div class="logo mb-3 is-flex">
|
|
5
|
+
<div class="logo mb-3 is-flex is-justify-content-center">
|
|
6
6
|
<figure class="image is-48x48 is-clickable is-flex"
|
|
7
7
|
@click="$router.push({ name: 'login' }).catch(routerErrorHandler)">
|
|
8
8
|
<img src="/images/logo.svg"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
</template>
|
|
20
20
|
|
|
21
21
|
<script>
|
|
22
|
-
import { mapState } from 'vuex';
|
|
23
22
|
import Errors from '@enso-ui/laravel-validation';
|
|
23
|
+
import { app } from '@enso-ui/ui/src/pinia/app';
|
|
24
24
|
import Submit from './Submit.vue';
|
|
25
25
|
|
|
26
26
|
export default {
|
|
@@ -47,7 +47,9 @@ export default {
|
|
|
47
47
|
}),
|
|
48
48
|
|
|
49
49
|
computed: {
|
|
50
|
-
|
|
50
|
+
meta() {
|
|
51
|
+
return app().meta;
|
|
52
|
+
},
|
|
51
53
|
},
|
|
52
54
|
};
|
|
53
55
|
</script>
|
|
@@ -57,16 +59,147 @@ export default {
|
|
|
57
59
|
max-width: 400px;
|
|
58
60
|
margin: auto;
|
|
59
61
|
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
+
.box {
|
|
63
|
+
border-radius: 1.25rem;
|
|
64
|
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
|
65
|
+
background: rgba(255, 255, 255, 0.92);
|
|
66
|
+
box-shadow: 0 24px 70px rgba(7, 22, 39, 0.22);
|
|
67
|
+
backdrop-filter: blur(14px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
form {
|
|
71
|
+
margin-bottom: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.control .input,
|
|
75
|
+
.control.has-icons-left .input,
|
|
76
|
+
.control.has-icons-right .input {
|
|
77
|
+
background-color: #f7fbff;
|
|
78
|
+
border-color: #c6d3e1;
|
|
79
|
+
color: #0f172a;
|
|
80
|
+
|
|
81
|
+
&::placeholder {
|
|
82
|
+
color: #64748b;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.control .icon {
|
|
87
|
+
color: #64748b;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.control .icon.is-left {
|
|
91
|
+
color: #475569 !important;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.checkbox,
|
|
95
|
+
.help,
|
|
96
|
+
.label {
|
|
97
|
+
color: #1e293b;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.auth-footer-link {
|
|
101
|
+
color: #334155;
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
text-shadow: none;
|
|
105
|
+
|
|
106
|
+
&:hover {
|
|
107
|
+
color: #0f172a;
|
|
108
|
+
}
|
|
62
109
|
}
|
|
63
110
|
|
|
64
111
|
.is-spaced {
|
|
65
112
|
margin-right: 1.6em;
|
|
66
113
|
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
[data-theme='dark'] {
|
|
117
|
+
.login {
|
|
118
|
+
.box {
|
|
119
|
+
border-color: rgba(107, 114, 128, 0.3);
|
|
120
|
+
background: rgba(18, 24, 35, 0.9);
|
|
121
|
+
box-shadow: 0 28px 80px rgba(1, 6, 16, 0.38);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.control .input,
|
|
125
|
+
.control.has-icons-left .input,
|
|
126
|
+
.control.has-icons-right .input {
|
|
127
|
+
background-color: rgba(10, 14, 22, 0.9);
|
|
128
|
+
border-color: #4b5563;
|
|
129
|
+
color: #f3f6fb;
|
|
130
|
+
|
|
131
|
+
&::placeholder {
|
|
132
|
+
color: #94a3b8;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.control .icon {
|
|
137
|
+
color: #94a3b8;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.control .icon.is-left {
|
|
141
|
+
color: #cbd5e1 !important;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.checkbox,
|
|
145
|
+
.help,
|
|
146
|
+
.label {
|
|
147
|
+
color: #e5ebf3;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.auth-footer-link {
|
|
151
|
+
color: #d7deea;
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
color: #f3f6fb;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (prefers-color-scheme: dark) {
|
|
161
|
+
html:not([data-theme]) {
|
|
162
|
+
.login {
|
|
163
|
+
.box {
|
|
164
|
+
border-color: rgba(107, 114, 128, 0.3);
|
|
165
|
+
background: rgba(18, 24, 35, 0.9);
|
|
166
|
+
box-shadow: 0 28px 80px rgba(1, 6, 16, 0.38);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.control .input,
|
|
170
|
+
.control.has-icons-left .input,
|
|
171
|
+
.control.has-icons-right .input {
|
|
172
|
+
background-color: rgba(10, 14, 22, 0.9);
|
|
173
|
+
border-color: #4b5563;
|
|
174
|
+
color: #f3f6fb;
|
|
175
|
+
|
|
176
|
+
&::placeholder {
|
|
177
|
+
color: #94a3b8;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.control .icon {
|
|
182
|
+
color: #94a3b8;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.control .icon.is-left {
|
|
186
|
+
color: #cbd5e1 !important;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.checkbox,
|
|
190
|
+
.help,
|
|
191
|
+
.label {
|
|
192
|
+
color: #e5ebf3;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.auth-footer-link {
|
|
196
|
+
color: #d7deea;
|
|
67
197
|
|
|
68
|
-
|
|
69
|
-
|
|
198
|
+
&:hover {
|
|
199
|
+
color: #f3f6fb;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
70
203
|
}
|
|
71
204
|
}
|
|
72
205
|
</style>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<transition enter-active-class="
|
|
3
|
-
leave-active-class="
|
|
2
|
+
<transition enter-active-class="animate__animated animate__zoomIn"
|
|
3
|
+
leave-active-class="animate__animated animate__zoomOut">
|
|
4
4
|
<svg v-if="password"
|
|
5
|
-
class="animated"
|
|
6
5
|
width="100%"
|
|
7
6
|
height="5"
|
|
8
7
|
version="1.1"
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<button class="button is-
|
|
2
|
+
<button class="button is-dark is-fullwidth"
|
|
3
3
|
:class="{ 'is-loading': loading }"
|
|
4
4
|
type="submit"
|
|
5
5
|
@click.prevent="submit">
|
|
6
6
|
<span class="icon is-small">
|
|
7
|
-
<fa :icon="
|
|
7
|
+
<fa :icon="resolvedIcon"/>
|
|
8
8
|
</span>
|
|
9
9
|
<span>{{ i18n(action) }}</span>
|
|
10
10
|
</button>
|
|
11
11
|
</template>
|
|
12
12
|
|
|
13
13
|
<script>
|
|
14
|
-
import {
|
|
14
|
+
import { app } from '@enso-ui/ui/src/pinia/app';
|
|
15
15
|
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
16
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
17
16
|
import { faLock, faUser } from '@fortawesome/free-solid-svg-icons';
|
|
18
17
|
|
|
19
|
-
library.add(faLock, faUser);
|
|
20
|
-
|
|
21
18
|
export default {
|
|
22
19
|
name: 'Submit',
|
|
23
20
|
|
|
@@ -31,7 +28,7 @@ export default {
|
|
|
31
28
|
required: true,
|
|
32
29
|
},
|
|
33
30
|
icon: {
|
|
34
|
-
type: String,
|
|
31
|
+
type: [String, Object],
|
|
35
32
|
required: true,
|
|
36
33
|
},
|
|
37
34
|
endpoint: {
|
|
@@ -51,7 +48,19 @@ export default {
|
|
|
51
48
|
}),
|
|
52
49
|
|
|
53
50
|
computed: {
|
|
54
|
-
|
|
51
|
+
resolvedIcon() {
|
|
52
|
+
if (typeof this.icon !== 'string') {
|
|
53
|
+
return this.icon;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
lock: faLock,
|
|
58
|
+
user: faUser,
|
|
59
|
+
}[this.icon] ?? this.icon;
|
|
60
|
+
},
|
|
61
|
+
isWebview() {
|
|
62
|
+
return app().isWebview;
|
|
63
|
+
},
|
|
55
64
|
config() {
|
|
56
65
|
return this.isWebview
|
|
57
66
|
? { headers: { isWebview: true } }
|
|
@@ -9,18 +9,21 @@
|
|
|
9
9
|
@input="$emit('update:modelValue', $event.target.value);
|
|
10
10
|
errors.clear('password')">
|
|
11
11
|
<span class="icon is-small is-left">
|
|
12
|
-
<fa icon="
|
|
12
|
+
<fa :icon="faLock"/>
|
|
13
13
|
</span>
|
|
14
14
|
<reveal-password :meta="meta"
|
|
15
|
-
:class="
|
|
15
|
+
:class="[
|
|
16
|
+
'has-text-dark',
|
|
17
|
+
{ 'mr-5': match || successful || errors.has('password') }
|
|
18
|
+
]"
|
|
16
19
|
v-if="modelValue && !successful"/>
|
|
17
20
|
<span v-if="errors.has('password')"
|
|
18
21
|
class="icon is-small is-right has-text-danger">
|
|
19
|
-
<fa icon="
|
|
22
|
+
<fa :icon="faExclamationTriangle"/>
|
|
20
23
|
</span>
|
|
21
24
|
<span v-if="match && !errors.has('password') || successful"
|
|
22
25
|
class="icon is-small is-right has-text-success">
|
|
23
|
-
<fa icon="
|
|
26
|
+
<fa :icon="faCheck"/>
|
|
24
27
|
</span>
|
|
25
28
|
</div>
|
|
26
29
|
<p class="has-text-danger is-size-7"
|
|
@@ -32,13 +35,10 @@
|
|
|
32
35
|
|
|
33
36
|
<script>
|
|
34
37
|
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
35
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
36
38
|
import { faCheck, faExclamationTriangle, faLock } from '@fortawesome/free-solid-svg-icons';
|
|
37
39
|
import { focus } from '@enso-ui/directives';
|
|
38
40
|
import RevealPassword from '@enso-ui/forms/src/bulma/parts/RevealPassword.vue';
|
|
39
41
|
|
|
40
|
-
library.add(faCheck, faExclamationTriangle, faLock);
|
|
41
|
-
|
|
42
42
|
export default {
|
|
43
43
|
name: 'Confirmation',
|
|
44
44
|
|
|
@@ -62,6 +62,9 @@ export default {
|
|
|
62
62
|
emits: ['update:modelValue'],
|
|
63
63
|
|
|
64
64
|
data: () => ({
|
|
65
|
+
faCheck,
|
|
66
|
+
faExclamationTriangle,
|
|
67
|
+
faLock,
|
|
65
68
|
meta: {
|
|
66
69
|
content: 'password',
|
|
67
70
|
},
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
autocomplete="email"
|
|
11
11
|
@input="$emit('update:modelValue', $event.target.value); errors.clear('email')">
|
|
12
12
|
<span class="icon is-small is-left">
|
|
13
|
-
<fa icon="
|
|
13
|
+
<fa :icon="faEnvelope"/>
|
|
14
14
|
</span>
|
|
15
15
|
<span v-if="successful"
|
|
16
16
|
class="icon is-small is-right has-text-success">
|
|
17
|
-
<fa icon="
|
|
17
|
+
<fa :icon="faCheck"/>
|
|
18
18
|
</span>
|
|
19
19
|
<span v-if="errors.has('email')"
|
|
20
20
|
class="icon is-small is-right has-text-danger">
|
|
21
|
-
<fa icon="
|
|
21
|
+
<fa :icon="faExclamationTriangle"/>
|
|
22
22
|
</span>
|
|
23
23
|
</div>
|
|
24
24
|
<p class="has-text-danger is-size-7"
|
|
@@ -30,12 +30,9 @@
|
|
|
30
30
|
|
|
31
31
|
<script>
|
|
32
32
|
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
33
|
-
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
34
33
|
import { faCheck, faExclamationTriangle, faEnvelope } from '@fortawesome/free-solid-svg-icons';
|
|
35
34
|
import { focus } from '@enso-ui/directives';
|
|
36
35
|
|
|
37
|
-
library.add(faCheck, faExclamationTriangle, faEnvelope);
|
|
38
|
-
|
|
39
36
|
export default {
|
|
40
37
|
name: 'Email',
|
|
41
38
|
|
|
@@ -59,5 +56,11 @@ export default {
|
|
|
59
56
|
return this.state.successful;
|
|
60
57
|
},
|
|
61
58
|
},
|
|
59
|
+
|
|
60
|
+
data: () => ({
|
|
61
|
+
faCheck,
|
|
62
|
+
faEnvelope,
|
|
63
|
+
faExclamationTriangle,
|
|
64
|
+
}),
|
|
62
65
|
};
|
|
63
66
|
</script>
|
|
@@ -9,18 +9,21 @@
|
|
|
9
9
|
:autocomplete="autocomplete"
|
|
10
10
|
@input="$emit('update:modelValue', $event.target.value); errors.clear('password')">
|
|
11
11
|
<span class="icon is-small is-left">
|
|
12
|
-
<fa icon="
|
|
12
|
+
<fa :icon="faLock"/>
|
|
13
13
|
</span>
|
|
14
14
|
<reveal-password :meta="meta"
|
|
15
|
-
:class="
|
|
15
|
+
:class="[
|
|
16
|
+
'has-text-dark',
|
|
17
|
+
{ 'is-spaced': successful || errors.has('password') }
|
|
18
|
+
]"
|
|
16
19
|
v-if="modelValue && !successful"/>
|
|
17
20
|
<span v-if="successful"
|
|
18
21
|
class="icon is-small is-right has-text-success">
|
|
19
|
-
<fa icon="
|
|
22
|
+
<fa :icon="faCheck"/>
|
|
20
23
|
</span>
|
|
21
24
|
<span v-if="errors.has('password')"
|
|
22
25
|
class="icon is-small is-right has-text-danger">
|
|
23
|
-
<fa icon="
|
|
26
|
+
<fa :icon="faExclamationTriangle"/>
|
|
24
27
|
</span>
|
|
25
28
|
<slot name="password-strength"
|
|
26
29
|
:password="modelValue"
|
|
@@ -35,13 +38,10 @@
|
|
|
35
38
|
|
|
36
39
|
<script>
|
|
37
40
|
import { FontAwesomeIcon as Fa } from '@fortawesome/vue-fontawesome';
|
|
38
|
-
import {
|
|
39
|
-
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
|
|
41
|
+
import { faCheck, faExclamationTriangle, faLock } from '@fortawesome/free-solid-svg-icons';
|
|
40
42
|
import { focus } from '@enso-ui/directives';
|
|
41
43
|
import RevealPassword from '@enso-ui/forms/src/bulma/parts/RevealPassword.vue';
|
|
42
44
|
|
|
43
|
-
library.add(faExclamationTriangle);
|
|
44
|
-
|
|
45
45
|
export default {
|
|
46
46
|
name: 'Password',
|
|
47
47
|
|
|
@@ -65,6 +65,9 @@ export default {
|
|
|
65
65
|
emits: ['update:modelValue'],
|
|
66
66
|
|
|
67
67
|
data: () => ({
|
|
68
|
+
faCheck,
|
|
69
|
+
faExclamationTriangle,
|
|
70
|
+
faLock,
|
|
68
71
|
meta: {
|
|
69
72
|
content: 'password',
|
|
70
73
|
},
|
package/src/bulma/routes/auth.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import store from '@enso-ui/ui/src/core/services/store';
|
|
2
|
-
|
|
3
1
|
const Login = () => import('../pages/auth/Login.vue');
|
|
4
2
|
const Email = () => import('../pages/auth/password/EmailResetLink.vue');
|
|
5
3
|
const Reset = () => import('../pages/auth/password/Reset.vue');
|
|
4
|
+
import { auth } from '../pinia/auth';
|
|
6
5
|
|
|
7
6
|
const redirect = (to, from, next) => {
|
|
8
|
-
if (
|
|
7
|
+
if (auth().isAuth) {
|
|
9
8
|
next({ path: '/' });
|
|
10
9
|
} else {
|
|
11
10
|
next();
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
<script>
|
|
2
|
-
import {
|
|
2
|
+
import { loadGuestState } from '@enso-ui/ui/src/pinia/loadState';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
name: 'Auth',
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
7
|
+
data: () => ({
|
|
8
|
+
ready: false,
|
|
9
|
+
}),
|
|
10
10
|
|
|
11
|
-
created() {
|
|
12
|
-
this.loadGuestState();
|
|
11
|
+
async created() {
|
|
12
|
+
await this.loadGuestState();
|
|
13
|
+
this.ready = true;
|
|
13
14
|
},
|
|
14
15
|
|
|
15
16
|
methods: {
|
|
16
|
-
|
|
17
|
+
loadGuestState() {
|
|
18
|
+
return loadGuestState();
|
|
19
|
+
},
|
|
17
20
|
},
|
|
18
21
|
|
|
19
22
|
render() {
|
|
20
23
|
return this.$slots.default({
|
|
21
|
-
guestState: this.
|
|
24
|
+
guestState: this.ready,
|
|
22
25
|
});
|
|
23
26
|
},
|
|
24
27
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { defineStore } from 'pinia';
|
|
3
|
+
|
|
4
|
+
const getRouter = () => import('@enso-ui/ui/src/core/services/router');
|
|
5
|
+
|
|
6
|
+
export const auth = defineStore('auth', {
|
|
7
|
+
state: () => ({
|
|
8
|
+
isAuth: localStorage.getItem('isAuth') === 'true',
|
|
9
|
+
intendedRoute: null,
|
|
10
|
+
intendedPath: null,
|
|
11
|
+
}),
|
|
12
|
+
|
|
13
|
+
actions: {
|
|
14
|
+
login() {
|
|
15
|
+
this.isAuth = true;
|
|
16
|
+
localStorage.setItem('isAuth', true);
|
|
17
|
+
},
|
|
18
|
+
setIntendedRoute(value) {
|
|
19
|
+
this.intendedRoute = value;
|
|
20
|
+
},
|
|
21
|
+
setIntendedPath(value) {
|
|
22
|
+
this.intendedPath = value;
|
|
23
|
+
},
|
|
24
|
+
logoutState() {
|
|
25
|
+
this.isAuth = false;
|
|
26
|
+
localStorage.setItem('isAuth', false);
|
|
27
|
+
localStorage.removeItem('authorization');
|
|
28
|
+
},
|
|
29
|
+
async logout() {
|
|
30
|
+
await axios.post('/api/logout');
|
|
31
|
+
this.logoutState();
|
|
32
|
+
const { default: router } = await getRouter();
|
|
33
|
+
router.push({ name: 'login' });
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
package/src/store/auth.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import router from '@enso-ui/ui/src/core/services/router';
|
|
3
|
-
|
|
4
|
-
export const state = {
|
|
5
|
-
isAuth: localStorage.getItem('isAuth') === 'true',
|
|
6
|
-
intendedRoute: null,
|
|
7
|
-
intendedPath: null,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const mutations = {
|
|
11
|
-
login(state) {
|
|
12
|
-
state.isAuth = true;
|
|
13
|
-
localStorage.setItem('isAuth', true);
|
|
14
|
-
},
|
|
15
|
-
logout(state) {
|
|
16
|
-
state.isAuth = false;
|
|
17
|
-
localStorage.setItem('isAuth', false);
|
|
18
|
-
localStorage.removeItem('authorization');
|
|
19
|
-
},
|
|
20
|
-
setIntendedRoute: (state, value) => (state.intendedRoute = value),
|
|
21
|
-
setIntendedPath: (state, value) => (state.intendedPath = value),
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const actions = {
|
|
25
|
-
logout({ commit }) {
|
|
26
|
-
axios.post('/api/logout').then(() => {
|
|
27
|
-
commit('appState', false, { root: true });
|
|
28
|
-
commit('logout');
|
|
29
|
-
router.push({ name: 'login' });
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
};
|