@live-change/user-frontend 0.0.3
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 +21 -0
- package/e2e/codecept.conf.js +60 -0
- package/e2e/connectEmailCode.test.js +61 -0
- package/e2e/connectEmailLink.test.js +60 -0
- package/e2e/delete.test.js +44 -0
- package/e2e/disconnectEmail.test.js +42 -0
- package/e2e/resetPasswordWithEmailCode.test.js +62 -0
- package/e2e/resetPasswordWithEmailLink.test.js +62 -0
- package/e2e/setPassword.test.js +70 -0
- package/e2e/signInEmailCode.test.js +52 -0
- package/e2e/signInEmailLink.test.js +52 -0
- package/e2e/signInEmailPassword.test.js +47 -0
- package/e2e/signOut.test.js +41 -0
- package/e2e/signUpEmailCode.test.js +41 -0
- package/e2e/signUpEmailLink.test.js +41 -0
- package/e2e/steps.d.ts +12 -0
- package/e2e/steps_file.js +89 -0
- package/front/index.html +11 -0
- package/front/public/favicon.ico +0 -0
- package/front/public/images/empty-photo.svg +38 -0
- package/front/public/images/empty-user-photo.svg +33 -0
- package/front/public/images/logo.svg +34 -0
- package/front/public/images/logo128.png +0 -0
- package/front/src/App.vue +31 -0
- package/front/src/Index.vue +14 -0
- package/front/src/NavBar.vue +103 -0
- package/front/src/SettingsTabs.vue +48 -0
- package/front/src/connected/Connect.vue +58 -0
- package/front/src/connected/ConnectFinished.vue +16 -0
- package/front/src/connected/Connected.vue +84 -0
- package/front/src/connected/routes.js +16 -0
- package/front/src/delete/Delete.vue +53 -0
- package/front/src/delete/DeleteFeedbackSent.vue +16 -0
- package/front/src/delete/DeleteFinished.vue +32 -0
- package/front/src/delete/routes.js +16 -0
- package/front/src/entry-client.js +6 -0
- package/front/src/entry-server.js +6 -0
- package/front/src/identification/IdentificationSettings.vue +116 -0
- package/front/src/identification/ObjectIdentification.vue +36 -0
- package/front/src/identification/UserIdentification.vue +101 -0
- package/front/src/identification/routes.js +12 -0
- package/front/src/message-auth/ConnectEmail.vue +105 -0
- package/front/src/message-auth/MessageLink.vue +95 -0
- package/front/src/message-auth/MessageSent.vue +103 -0
- package/front/src/message-auth/ResetPasswordEmail.vue +105 -0
- package/front/src/message-auth/SignInEmail.vue +105 -0
- package/front/src/message-auth/SignUpEmail.vue +105 -0
- package/front/src/message-auth/routes.js +25 -0
- package/front/src/notifications/NotificationButtons.vue +70 -0
- package/front/src/notifications/NotificationListPage.vue +22 -0
- package/front/src/notifications/NotificationsIcon.vue +75 -0
- package/front/src/notifications/NotificationsList.vue +144 -0
- package/front/src/notifications/NotificationsSettings.vue +117 -0
- package/front/src/notifications/SimpleNotification.vue +34 -0
- package/front/src/notifications/TestNotification.vue +25 -0
- package/front/src/notifications/UnknownNotification.vue +25 -0
- package/front/src/notifications/notificationTypes.js +11 -0
- package/front/src/notifications/routes.js +37 -0
- package/front/src/password/ChangePassword.vue +106 -0
- package/front/src/password/ChangePasswordFinished.vue +16 -0
- package/front/src/password/ResetPassword.vue +56 -0
- package/front/src/password/ResetPasswordFinished.vue +16 -0
- package/front/src/password/ResetPasswordForm.vue +118 -0
- package/front/src/password/routes.js +41 -0
- package/front/src/router.js +90 -0
- package/front/src/settings/Settings.vue +33 -0
- package/front/src/settings/SettingsIndex.vue +22 -0
- package/front/src/settings/SettingsMenu.vue +81 -0
- package/front/src/settings/SettingsMenuItem.vue +35 -0
- package/front/src/sign/SignIn.vue +93 -0
- package/front/src/sign/SignInFinished.vue +27 -0
- package/front/src/sign/SignOut.vue +37 -0
- package/front/src/sign/SignOutFinished.vue +16 -0
- package/front/src/sign/SignUp.vue +51 -0
- package/front/src/sign/SignUpFinished.vue +16 -0
- package/front/src/sign/routes.js +24 -0
- package/front/vite.config.js +11 -0
- package/index.js +11 -0
- package/package.json +87 -0
- package/server/init.js +53 -0
- package/server/security.config.js +53 -0
- package/server/services.config.js +74 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function routes(config = {}) {
|
|
2
|
+
const { prefix = '/', route = (r) => r } = config
|
|
3
|
+
|
|
4
|
+
return [
|
|
5
|
+
|
|
6
|
+
route({ name: 'user:signIn', path: prefix + 'sign-in',
|
|
7
|
+
component: () => import("./SignIn.vue") }),
|
|
8
|
+
route({ name: 'user:signInFinished', path: prefix + 'sign-in-finished',
|
|
9
|
+
component: () => import("./SignInFinished.vue") }),
|
|
10
|
+
|
|
11
|
+
route({ name: 'user:signUp', path: prefix + 'sign-up',
|
|
12
|
+
component: () => import("./SignUp.vue") }),
|
|
13
|
+
route({ name: 'user:signUpFinished', path: prefix + 'sign-up-finished',
|
|
14
|
+
component: () => import("./SignUpFinished.vue") }),
|
|
15
|
+
|
|
16
|
+
route({ name: 'user:signOut', path: prefix + 'sign-out',
|
|
17
|
+
component: () => import("./SignOut.vue") }),
|
|
18
|
+
route({ name: 'user:signOutFinished', path: prefix + 'sign-out-finished',
|
|
19
|
+
component: () => import("./SignOutFinished.vue") }),
|
|
20
|
+
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default routes
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import UserIdentification from "./front/src/identification/UserIdentification.vue"
|
|
2
|
+
import ObjectIdentification from "./front/src/identification/ObjectIdentification.vue"
|
|
3
|
+
export { UserIdentification, ObjectIdentification }
|
|
4
|
+
|
|
5
|
+
import NotificationsIcon from "./front/src/notifications/NotificationsIcon.vue"
|
|
6
|
+
import SimpleNotification from "./front/src/notifications/SimpleNotification.vue"
|
|
7
|
+
import { notificationTypes } from "./front/src/notifications/notificationTypes.js"
|
|
8
|
+
export { NotificationsIcon, SimpleNotification, notificationTypes }
|
|
9
|
+
|
|
10
|
+
import { userRoutes, installUserRedirects } from "./front/src/router.js"
|
|
11
|
+
export { userRoutes, installUserRedirects }
|
package/package.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@live-change/user-frontend",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"memDev": "lcli memDev --enableSessions --initScript ./init.js --dbAccess",
|
|
6
|
+
"localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
|
|
7
|
+
"localDev": "lcli localDev --enableSessions",
|
|
8
|
+
"dev": "lcli dev --enableSessions",
|
|
9
|
+
"ssrDev": "lcli ssrDev --enableSessions",
|
|
10
|
+
"serveAllMem": "cross-env NODE_ENV=production lcli ssrServer --withApi --withServices --updateServices --enableSessions --withDb --dbBackend mem --createDb",
|
|
11
|
+
"serveAll": "cross-env NODE_ENV=production lcli ssrServer --withApi --withServices --updateServices --enableSessions",
|
|
12
|
+
"serve": "cross-env NODE_ENV=production lcli ssrServer --enableSessions",
|
|
13
|
+
"apiServer": "lcli apiServer --enableSessions",
|
|
14
|
+
"devApiServer": "lcli devApiServer --enableSessions",
|
|
15
|
+
"memApiServer": "lcli memApiServer --enableSessions",
|
|
16
|
+
"build": "cd front; yarn build:client && yarn build:server",
|
|
17
|
+
"build:client": "cd front; vite build --ssrManifest --outDir dist/client",
|
|
18
|
+
"build:server": "cd front; vite build --ssr src/entry-server.js --outDir dist/server",
|
|
19
|
+
"generate": "vite build --ssrManifest --outDir dist/static && yarn build:server && node prerender",
|
|
20
|
+
"debug": "node --inspect-brk server"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@live-change/cli": "0.6.5",
|
|
24
|
+
"@live-change/dao": "0.4.13",
|
|
25
|
+
"@live-change/dao-vue3": "0.4.13",
|
|
26
|
+
"@live-change/dao-websocket": "0.4.13",
|
|
27
|
+
"@live-change/email-service": "0.2.37",
|
|
28
|
+
"@live-change/framework": "0.6.5",
|
|
29
|
+
"@live-change/identicon-service": "^0.2.37",
|
|
30
|
+
"@live-change/image-frontend": "0.0.3",
|
|
31
|
+
"@live-change/message-authentication-service": "0.2.37",
|
|
32
|
+
"@live-change/notification-service": "^0.2.37",
|
|
33
|
+
"@live-change/password-authentication-service": "0.2.39",
|
|
34
|
+
"@live-change/pattern": "0.2.1",
|
|
35
|
+
"@live-change/secret-code-service": "0.2.39",
|
|
36
|
+
"@live-change/secret-link-service": "0.2.39",
|
|
37
|
+
"@live-change/security-frontend": "0.0.3",
|
|
38
|
+
"@live-change/security-service": "0.2.37",
|
|
39
|
+
"@live-change/session-service": "0.2.39",
|
|
40
|
+
"@live-change/timer-service": "0.2.37",
|
|
41
|
+
"@live-change/upload-service": "^0.2.22",
|
|
42
|
+
"@live-change/user-identification-service": "0.2.37",
|
|
43
|
+
"@live-change/user-service": "0.2.37",
|
|
44
|
+
"@live-change/vue3-components": "0.2.12",
|
|
45
|
+
"@live-change/vue3-ssr": "0.2.14",
|
|
46
|
+
"@vitejs/plugin-vue": "^2.3.1",
|
|
47
|
+
"@vitejs/plugin-vue-jsx": "^1.3.10",
|
|
48
|
+
"@vue/compiler-sfc": "^3.2.33",
|
|
49
|
+
"@vueuse/core": "^8.3.1",
|
|
50
|
+
"codeceptjs-assert": "^0.0.5",
|
|
51
|
+
"codeceptjs-video-helper": "^0.1.3",
|
|
52
|
+
"compression": "^1.7.4",
|
|
53
|
+
"cross-env": "^7.0.3",
|
|
54
|
+
"get-port-sync": "1.0.1",
|
|
55
|
+
"primeflex": "^3.2.1",
|
|
56
|
+
"primeicons": "^5.0.0",
|
|
57
|
+
"primevue": "^3.15.0",
|
|
58
|
+
"rollup-plugin-node-builtins": "^2.1.2",
|
|
59
|
+
"rollup-plugin-visualizer": "5.6.0",
|
|
60
|
+
"sass": "^1.53.0",
|
|
61
|
+
"serialize-javascript": "^6.0.0",
|
|
62
|
+
"serve-static": "^1.15.0",
|
|
63
|
+
"unique-names-generator": "4.7.1",
|
|
64
|
+
"v-shared-element": "3.1.0",
|
|
65
|
+
"vite": "^2.9.6",
|
|
66
|
+
"vite-plugin-compression": "0.5.1",
|
|
67
|
+
"vite-plugin-vue-images": "^0.6.1",
|
|
68
|
+
"vue": "^3.2.33",
|
|
69
|
+
"vue-meta": "^3.0.0-alpha.9",
|
|
70
|
+
"vue-router": "^4.0.14",
|
|
71
|
+
"vue3-scroll-border": "0.1.2",
|
|
72
|
+
"wtfnode": "^0.9.1"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@live-change/codeceptjs-helper": "0.6.5",
|
|
76
|
+
"@wdio/selenium-standalone-service": "^7.19.5",
|
|
77
|
+
"codeceptjs": "^3.3.1",
|
|
78
|
+
"generate-password": "1.7.0",
|
|
79
|
+
"playwright": "^1.21.1",
|
|
80
|
+
"random-profile-generator": "^2.3.0",
|
|
81
|
+
"txtgen": "^3.0.1",
|
|
82
|
+
"webdriverio": "^7.19.5"
|
|
83
|
+
},
|
|
84
|
+
"author": "",
|
|
85
|
+
"license": "ISC",
|
|
86
|
+
"description": ""
|
|
87
|
+
}
|
package/server/init.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const App = require('@live-change/framework')
|
|
2
|
+
const app = App.app()
|
|
3
|
+
|
|
4
|
+
module.exports = async function(services) {
|
|
5
|
+
|
|
6
|
+
const user = '[testUser]'
|
|
7
|
+
const email = 'tester@test.com'
|
|
8
|
+
const email2 = 'tester2@test.com'
|
|
9
|
+
const password = 'Testy123'
|
|
10
|
+
const session = 'GOzz0WylRDklhLCSppS6bwRYUeIQJqzt'
|
|
11
|
+
//console.log("MDL", services.passwordAuthentication.models.PasswordAuthentication)
|
|
12
|
+
const passwordHash = services.passwordAuthentication.models.PasswordAuthentication
|
|
13
|
+
.definition.properties.passwordHash.preFilter(password)
|
|
14
|
+
await services.user.models.User.create({ id: user, roles: [] })
|
|
15
|
+
await services.passwordAuthentication.models.PasswordAuthentication.create({ id: user, user, passwordHash })
|
|
16
|
+
await services.email.models.Email.create({ id: email, email, user })
|
|
17
|
+
await services.email.models.Email.create({ id: email2, email: email2, user })
|
|
18
|
+
|
|
19
|
+
await services.user.models.AuthenticatedUser.create({ id: session, session, user })
|
|
20
|
+
|
|
21
|
+
await services.notification.models.NotificationSetting.create({
|
|
22
|
+
id: App.encodeIdentifier([ 'email_Email', email, 'example_TestNotification', 'example_TestNotification' ]),
|
|
23
|
+
contactType: 'email_Email',
|
|
24
|
+
contact: email,
|
|
25
|
+
notificationType: 'example_TestNotification',
|
|
26
|
+
notification: 'example_TestNotification',
|
|
27
|
+
active: true,
|
|
28
|
+
lastChanged: new Date()
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
await services.notification.models.Notification.create({
|
|
32
|
+
id: app.generateUid(),
|
|
33
|
+
sessionOrUserType: 'user_User',
|
|
34
|
+
sessionOrUser: user,
|
|
35
|
+
time: new Date(),
|
|
36
|
+
state: 'new',
|
|
37
|
+
readState: 'new',
|
|
38
|
+
notificationType: 'example_TestNotification'
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
for(let i = 1; i <= 12; i++) {
|
|
42
|
+
await services.notification.models.Notification.create({
|
|
43
|
+
id: app.generateUid(),
|
|
44
|
+
sessionOrUserType: 'user_User',
|
|
45
|
+
sessionOrUser: user,
|
|
46
|
+
time: new Date(Date.now() - i * 60 * 1000),
|
|
47
|
+
state: 'new',
|
|
48
|
+
readState: 'new',
|
|
49
|
+
notificationType: 'example_RandomNotification'
|
|
50
|
+
})
|
|
51
|
+
} //*/
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const lcp = require("@live-change/pattern")
|
|
2
|
+
|
|
3
|
+
const clientKeys = (client) => [
|
|
4
|
+
{ key: 'user', value: client.user },
|
|
5
|
+
{ key: 'session', value: client.session },
|
|
6
|
+
{ key: 'ip', value: client.ip }
|
|
7
|
+
]
|
|
8
|
+
|
|
9
|
+
const failedAuthCodes = lcp.chain([
|
|
10
|
+
{ type: "wrong-secret-code", id: "1st-failed-secret-code" },
|
|
11
|
+
{ eq: "ip", expire: "10m" },
|
|
12
|
+
{ type: "wrong-secret-code", id: "2nd-failed-secret-code" },
|
|
13
|
+
{ eq: "ip", expire: "10m" },
|
|
14
|
+
{ type: "wrong-secret-code", id: "3rd-failed-secret-code",
|
|
15
|
+
actions: [
|
|
16
|
+
{ type: 'ban', keys: ['ip'], ban: { type: 'captcha', actions: ['checkSecretCode'], expire: "30m" } }
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
]).model
|
|
20
|
+
|
|
21
|
+
const patterns = lcp.mergeModels(
|
|
22
|
+
//failedAuthCodes
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const counters = [
|
|
26
|
+
{
|
|
27
|
+
id: 'wrong-codes-captcha',
|
|
28
|
+
match: ['wrong-secret-code'],
|
|
29
|
+
keys: ['ip'],
|
|
30
|
+
max: 2,
|
|
31
|
+
duration: '1m',
|
|
32
|
+
actions: [
|
|
33
|
+
{ type: 'ban', keys: ['ip'], ban: { type: 'captcha', actions: ['checkSecretCode'], expire: "30m" } }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'wrong-codes-ban',
|
|
38
|
+
visible: true,
|
|
39
|
+
match: ['wrong-secret-code'],
|
|
40
|
+
keys: ['ip'],
|
|
41
|
+
max: 5,
|
|
42
|
+
duration: '10m',
|
|
43
|
+
actions: [
|
|
44
|
+
{ type: 'ban', keys: ['ip'], ban: { type: 'block', actions: ['checkSecretCode'], expire: "2m" } }
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
module.exports = {
|
|
50
|
+
clientKeys,
|
|
51
|
+
patterns,
|
|
52
|
+
counters
|
|
53
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const contactTypes = ['email']
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
services: [
|
|
5
|
+
{
|
|
6
|
+
name: 'timer',
|
|
7
|
+
path: '@live-change/timer-service'
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'session',
|
|
11
|
+
path: '@live-change/session-service',
|
|
12
|
+
createSessionOnUpdate: true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'user',
|
|
16
|
+
path: '@live-change/user-service'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'email',
|
|
20
|
+
path: '@live-change/email-service'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'secretLink',
|
|
24
|
+
path: '@live-change/secret-link-service'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'secretCode',
|
|
28
|
+
path: '@live-change/secret-code-service'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'messageAuthentication',
|
|
32
|
+
path: '@live-change/message-authentication-service',
|
|
33
|
+
contactTypes,
|
|
34
|
+
signUp: true,
|
|
35
|
+
signIn: true,
|
|
36
|
+
connect: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'passwordAuthentication',
|
|
40
|
+
path: '@live-change/password-authentication-service',
|
|
41
|
+
contactTypes,
|
|
42
|
+
signInWithoutPassword: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'security',
|
|
46
|
+
path: '@live-change/security-service',
|
|
47
|
+
...require('./security.config.js')
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'userIdentification',
|
|
51
|
+
path: '@live-change/user-identification-service'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'identicon',
|
|
55
|
+
path: '@live-change/identicon-service'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'notification',
|
|
59
|
+
path: '@live-change/notification-service',
|
|
60
|
+
contactTypes,
|
|
61
|
+
notificationTypes: ['example_TestNotification']
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'upload',
|
|
65
|
+
path: '@live-change/upload-service'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'image',
|
|
69
|
+
path: '@live-change/image-service'
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// { path: '@live-change/google-account-service' },
|
|
73
|
+
]
|
|
74
|
+
}
|