@live-change/access-control-frontend 0.2.22 → 0.2.23

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.
@@ -0,0 +1,41 @@
1
+ const happyPath = false
2
+
3
+ const randomProfile = require('random-profile-generator')
4
+
5
+ Feature('access control invite')
6
+
7
+ Scenario('invite user that will register from invitation link - path 2', async ({ I }) => {
8
+
9
+ const adminUser = await I.haveUser()
10
+ await I.haveUserWithAccess(adminUser, 'example_Example', 'one', ['administrator'])
11
+
12
+ const invitedName = randomProfile.profile().firstName
13
+ const invitedEmail = invitedName.split(' ')[0].toLowerCase() + (Math.random()*100).toFixed() + '@test.com'
14
+
15
+ console.log('ADMIN', adminUser)
16
+ console.log("INVITED EMAIL", invitedEmail)
17
+
18
+ session('Inviting', async () => {
19
+ await I.amOnPage('/')
20
+ await I.amLoggedIn(adminUser)
21
+ I.see('Access Granted!')
22
+ I.click('Share')
23
+ I.see('Access Control')
24
+ I.click('Invite with email')
25
+ I.see('Invite user with email')
26
+ I.see('Email address')
27
+ I.fillField('input[id="email"]', invitedEmail)
28
+ I.click('Invite')
29
+ })
30
+
31
+ session('Invited',
32
+ async () => {
33
+ await I.useEmailLink(invitedEmail, '/user/link/')
34
+ })
35
+
36
+ session('Inviting', () => {
37
+ I.see('Access Invitations')
38
+ I.see(invitedEmail)
39
+ I.wait(23)
40
+ })
41
+ })
@@ -0,0 +1,65 @@
1
+ const happyPath = false
2
+
3
+ const randomProfile = require('random-profile-generator')
4
+
5
+ Feature('access control invite')
6
+
7
+ Scenario('invite user that will register itself at the same time - path 3', async ({ I }) => {
8
+
9
+ const adminUser = await I.haveUser()
10
+ await I.haveUserWithAccess(adminUser, 'example_Example', 'one', ['administrator'])
11
+
12
+ const invitedName = randomProfile.profile().firstName
13
+ const invitedEmail = invitedName.split(' ')[0].toLowerCase() + (Math.random()*100).toFixed() + '@test.com'
14
+
15
+ console.log('ADMIN', adminUser)
16
+ console.log("INVITED EMAIL", invitedEmail)
17
+
18
+ session('Inviting', async () => {
19
+ await I.amOnPage('/')
20
+ await I.amLoggedIn(adminUser)
21
+ I.see('Access Granted!')
22
+ I.click('Share')
23
+ I.see('Access Control')
24
+ I.click('Invite with email')
25
+ I.see('Invite user with email')
26
+ I.see('Email address')
27
+ I.fillField('input[id="email"]', invitedEmail)
28
+ I.click('Invite')
29
+ })
30
+
31
+ session('Invited', async () => {
32
+ I.amOnPage('/user/sign-up')
33
+
34
+ I.fillField('input[id="email"]', invitedEmail)
35
+ I.click('button[type="submit"]')
36
+
37
+ I.seeInCurrentUrl('/sent/')
38
+ const url = await I.grabCurrentUrl()
39
+ const authentication = url.split('/').pop()
40
+
41
+ const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
42
+ console.log("AUTHENTICATION DATA", authenticationData)
43
+ I.assert(!!authenticationData, true, 'authentication created')
44
+
45
+ const linkData = await I.useSecretLink(authentication, true, '/user')
46
+
47
+ I.seeInCurrentUrl('/user/sign-up-finished')
48
+ const clientSession = await I.executeScript(() => api.client.value.session)
49
+ const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
50
+ const authenticatedUserData = await AuthenticatedUser.get(clientSession)
51
+ I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
52
+ const clientUser = await I.executeScript(() => api.client.value.user)
53
+ console.log("CLIENT USER", clientUser)
54
+ console.log("SERVER AUTHENTICATION", authenticatedUserData)
55
+ I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
56
+
57
+
58
+ })
59
+
60
+ session('Inviting', () => {
61
+ I.see('Access Invitations')
62
+ I.see(invitedName)
63
+ I.wait(23)
64
+ })
65
+ })
@@ -1,23 +1,44 @@
1
- const happyPath = false
1
+ const happyPath = true
2
2
 
3
3
  Feature('access control invite')
4
4
 
5
- Scenario('invite user that already exists', async ({ I }) => {
5
+ Scenario('invite user that already exists - path 1', async ({ I }) => {
6
6
 
7
7
  const adminUser = await I.haveUser()
8
8
  const anotherUser = await I.haveUser()
9
9
  await I.haveUserWithAccess(adminUser, 'example_Example', 'one', ['administrator'])
10
10
 
11
- await I.amOnPage('/')
12
- await I.amLoggedIn(adminUser)
11
+ console.log('ADMIN', adminUser)
12
+ console.log("ANOTHER USER", anotherUser)
13
13
 
14
- I.see('Access Granted!')
15
- I.click('Share')
16
- I.see('Access Control')
17
- I.click('Invite with email')
18
- I.see('Invite user with email')
19
- I.see('Email address')
20
- I.fillField('input[id="email"]', anotherUser.email)
21
- I.click('Invite')
22
- I.click('Invite')
14
+ session('X')
15
+ session('Y')
16
+ I.amOnPage('/')
17
+
18
+ session('X', async () => {
19
+ await I.amOnPage('/')
20
+ await I.amLoggedIn(adminUser)
21
+ I.see('Access Granted!')
22
+ I.click('Share')
23
+ I.see('Access Control')
24
+ I.click('Invite with email')
25
+ I.see('Invite user with email')
26
+ I.see('Email address')
27
+ I.fillField('input[id="email"]', anotherUser.email)
28
+ I.click('Invite')
29
+ I.wait(5)
30
+ I.see('Access Invitations')
31
+ //I.see(anotherUser.name)
32
+ })
33
+ session('Y', async () => {
34
+ I.amOnPage('/')
35
+ await I.amLoggedIn(anotherUser)
36
+ I.click('i.pi.pi-bell')
37
+ I.click('Accept')
38
+ })
39
+ session('X', () =>{
40
+ I.see('Authorized')
41
+ I.see(anotherUser.name)
42
+ I.wait(23)
43
+ })
23
44
  })
@@ -37,6 +37,11 @@ export function routes(config = {}) {
37
37
  }
38
38
  }),
39
39
 
40
+ route({
41
+ name: 'accessControl:invitationAccepted', path: prefix + '', meta: { },
42
+ redirect: { name: 'accessControl:testPage' }
43
+ }),
44
+
40
45
  ...dbAdminRoutes({ prefix: '/_db', route: r => ({ ...r, meta: { ...r.meta, raw: true }}) })
41
46
  ]
42
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/access-control-frontend",
3
- "version": "0.2.22",
3
+ "version": "0.2.23",
4
4
  "scripts": {
5
5
  "memDev": "lcli memDev --enableSessions --initScript ./init.js --dbAccess",
6
6
  "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
@@ -20,20 +20,20 @@
20
20
  "debug": "node --inspect-brk server"
21
21
  },
22
22
  "dependencies": {
23
- "@live-change/access-control-service": "0.3.8",
24
- "@live-change/cli": "0.7.6",
23
+ "@live-change/access-control-service": "0.3.10",
24
+ "@live-change/cli": "0.7.8",
25
25
  "@live-change/dao": "0.5.8",
26
26
  "@live-change/dao-vue3": "0.5.8",
27
27
  "@live-change/dao-websocket": "0.5.8",
28
- "@live-change/db-admin": "0.5.20",
29
- "@live-change/framework": "0.7.6",
30
- "@live-change/frontend-base": "^0.2.22",
31
- "@live-change/password-authentication-service": "0.3.8",
32
- "@live-change/secret-code-service": "0.3.8",
33
- "@live-change/secret-link-service": "0.3.8",
34
- "@live-change/session-service": "0.3.8",
35
- "@live-change/user-frontend": "^0.2.22",
36
- "@live-change/user-service": "0.3.8",
28
+ "@live-change/db-admin": "0.5.22",
29
+ "@live-change/framework": "0.7.8",
30
+ "@live-change/frontend-base": "^0.2.23",
31
+ "@live-change/password-authentication-service": "0.3.10",
32
+ "@live-change/secret-code-service": "0.3.10",
33
+ "@live-change/secret-link-service": "0.3.10",
34
+ "@live-change/session-service": "0.3.10",
35
+ "@live-change/user-frontend": "^0.2.23",
36
+ "@live-change/user-service": "0.3.10",
37
37
  "@live-change/vue3-components": "0.2.16",
38
38
  "@live-change/vue3-ssr": "0.2.16",
39
39
  "@vueuse/core": "^9.1.0",
@@ -53,7 +53,7 @@
53
53
  "vue3-scroll-border": "0.1.4"
54
54
  },
55
55
  "devDependencies": {
56
- "@live-change/codeceptjs-helper": "0.7.6",
56
+ "@live-change/codeceptjs-helper": "0.7.8",
57
57
  "@wdio/selenium-standalone-service": "^7.20.8",
58
58
  "codeceptjs": "^3.3.4",
59
59
  "generate-password": "1.7.0",
@@ -65,5 +65,5 @@
65
65
  "author": "",
66
66
  "license": "BSD-3-Clause",
67
67
  "description": "",
68
- "gitHead": "01a04dd2c01a8f2f899673466b6d4c45b475f4a4"
68
+ "gitHead": "1fd24d66ea25432bff4a9a9cb8435a489bfaa602"
69
69
  }