Rocket.chat: [BUG] Invite link shows Invalid or expired invite token if Registration Form is disabled

Created on 12 Mar 2020  ยท  8Comments  ยท  Source: RocketChat/Rocket.Chat

Description:

Invite link shows Invalid or expired invite token if Registration Form is in disabled state.
But after refresh (F5 in browser or CTRL+R in Electron) user gets in private chat.

Steps to reproduce:

  1. Go to Admin UI => Account => Registration
  2. Set Registration Form to Disabled
  3. As private channel owner generate a valid invite link
  4. Share that invite link with your Rocket.Chat server users
  5. User press link and gets Invalid or expired invite token error
  6. User refresh page (F5 in browser or CTRL+R in Electron) and gets in private chat

Expected behavior:

Step 5 from Steps to reproduce is error and users don't need it

Actual behavior:

image
image

Server Setup Information:

  • Version of Rocket.Chat Server: 3.0.3
  • Operating System: CentOS7
  • Deployment Method: docker
  • Number of Running Instances: 12
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: v12.14.0
  • MongoDB Version: 4.0.13

Client Setup Information

  • Desktop App Version: 2.17.7
  • Operating System: Windows 10

Relevant logs:

I20200312-05:22:24.382(0) API โž” debug POST: /api/v1/validateInviteToken 
I20200312-05:22:24.386(0) API โž” debug Success { statusCode: 200, body: { valid: true, success: true } } 
I20200312-05:22:24.396(0) API โž” debug POST: /api/v1/useInviteToken 
I20200312-05:22:24.408(0) Meteor โž” method stream -> userId: null, arguments: ["notify-user","gYFnyDxfwdDom9jeR/userData",{"0":{"diff":{"_updatedAt":"2020-03-12T05:22:24.401Z","inviteToken":"2Eg3Ne"},"type":"updated"}}] 
I20200312-05:22:24.409(0) Meteor โž” method stream -> userId: null, arguments: ["notify-user","gYFnyDxfwdDom9jeR/userData",{"0":{"diff":{"_updatedAt":"2020-03-12T05:22:24.401Z","inviteToken":"2Eg3Ne"},"type":"updated"}}] 
I20200312-05:22:24.419(0) API โž” debug Success {   statusCode: 200,   body: {     room: {       rid: 'FPywz6abqTBQzp5zZ',       prid: undefined,       fname: 'test-invite5',       name: 'test-invite5',       t: 'p'     },     success: true   } } 
I20200312-05:22:24.421(0) Integrations โž” Outgoing WebHook.debug Execute Trigger: roomJoined 
I20200312-05:22:24.422(0) Integrations โž” Outgoing WebHook.debug Got the event arguments for the event: roomJoined {   event: 'roomJoined',   user: {     _id: 'gYFnyDxfwdDom9jeR',     createdAt: 2019-12-13T06:00:11.733Z,     services: { ldap: [Object], keycloak: [Object], resume: [Object] },     username: 'karlanaat01',     emails: [ [Object] ],     type: 'user',     status: 'online',     active: true,     _updatedAt: 2020-03-12T05:22:19.324Z,     roles: [ 'user' ],     name: '(Test1)',     customFields: {       Title: '',       Department: '',       l: ''     },     ldap: true,     lastLogin: 2020-03-12T05:22:19.298Z,     statusConnection: 'online',     utcOffset: 3,     e2e: {       private_key: '{"$binary":"O/fpY5CBCDzcF2m1cNSpKe0wVNMV2QpRbuUuxo2Wk7kGNFXzjdVmY9BHLxEOWP8RL3OYod6XX47AClzR+nImnF5A49ma3LS9xCagoA8HyDaUNSRXk3JW9V03bLeWM+E93LIiyJBY7isjo5RJOZU3zu0pKUePCtaJtfj3n2m5ziDV5gmrEV9B+n7BDMYzbznrAak4IZrcWlpnxEjJSt8mqNFwLx7aCGAdCe2TTL+AHvgkeRB7pI5XXpbwJrorL0luotWn2C931nxXLE4dowbRHnJlRCFwXImhz9pU5dSWt2+FtMWd41WHz2zp1a3AzsCRitVhw14k2QHxLnj/9fTtxeC9p1+wLhQOjjAj8ZcP9wNRD1GT4HXkEWdoYLDYAoWn4lt3k2dRlcrna7hfT9lKV+478C+dj5DxdQ0lzYt4mhzaE9a9NbktxUhapRunzspcBZ0evhWsd0kH2DBBlf/Ch7Kzon0GaGCXvX+Z7kkmrMvnKk8mJYK3wPKvk3TTSk4SklyLZSfWGQZx3HOKfPvt6WUeP2PEvU/ClIYKm9NFcm87LXadrT5W+ipWiQicvrknAjjRd7zRACESVmXQ1VDDOpSLHXDQvQOh1sMtp/r6ONtFdMJ0lWlSds6zNhc9MUt8fL8ksMJIX11HOjay8ZXuf69k091k6Nd2jVTpmlcaP86mxaefVqZC7QaOALKJbgmfbfFjOk99H67Op/MbIOQ645bNJ7yiQlXHyGQQMuvSvV09DVfYwPiW1lpX==skipped=="}',       public_key: '{"alg":"RSA-OAEP-256","e":"AQAB","ext":true,"key_ops":["encrypt"],"kty":"RSA","n":"8HgRH_AxEXk0BCONT5_I1mqV7InbFxuaFA_Rz-uf-FRRxH4fcS7g3P_IN6cBjZWhtmg0L4nuW9rkCWeMgFjHqu7DyHIIG6Xrg7Cpr5mY-kCF_zZwwjDXO09uiVClaUAOm_WVOiPtzxq8wY9Psf81EYy0==skipped=="}'     },     statusText: '',     statusDefault: 'online',     settings: { preferences: [Object] },     language: 'en',     inviteToken: 'CPLcxd'   },   room: {     _id: 'FPywz6abqTBQzp5zZ',     name: 'test-invite5',     fname: 'test-invite5',     t: 'p',     msgs: 0,     usersCount: 1,     u: { _id: 'iodE4TwMg4i729GoH', username: 'karlanaa' },     customFields: {},     broadcast: false,     encrypted: false,     ts: 2020-03-12T05:22:03.529Z,     ro: false,     default: false,     sysMes: true,     _updatedAt: 2020-03-12T05:22:03.558Z   } } 
I20200312-05:22:24.423(0) Integrations โž” Outgoing WebHook.debug Starting search for triggers for the room: FPywz6abqTBQzp5zZ 
I20200312-05:22:24.423(0) Integrations โž” Outgoing WebHook.debug Found 0 to iterate over and see if the match the event. 
I20200312-05:22:24.446(0) Meteor โž” method getRoomByTypeAndName -> userId: gYFnyDxfwdDom9jeR, arguments: ["p","test-invite5"] 
I20200312-05:22:24.449(0) Meteor โž” method canAccessRoom -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ","gYFnyDxfwdDom9jeR"] 
I20200312-05:22:24.459(0) Meteor โž” method loadHistory -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ",{},50,{}] 
I20200312-05:22:24.460(0) Meteor โž” method canAccessRoom -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ","gYFnyDxfwdDom9jeR"] 
I20200312-05:22:24.466(0) Meteor โž” method canAccessRoom -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ","gYFnyDxfwdDom9jeR",null] 
I20200312-05:22:24.473(0) Meteor โž” method getRoomRoles -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ"] 
I20200312-05:22:25.019(0) Meteor โž” method readMessages -> userId: gYFnyDxfwdDom9jeR, arguments: ["FPywz6abqTBQzp5zZ"] 
triaged uux

Most helpful comment

Confirmed on 2.4.11

All 8 comments

We have Registration Form Disabled because out Rocket.Chat environment is LDAP-enabled and for now isolated for external users.
We plan to set Registration Form to Secret URL after that https://github.com/RocketChat/feature-requests/issues/295 feature will be implemented, i.e when new registered users will be associated with custom role, that restricted in permissions a lot.

Confirmed on 3.0.2 as well

Confirmed on 2.4.11

We have Registration Form Disabled because out Rocket.Chat environment is LDAP-enabled and for now isolated for external users.
We plan to set Registration Form to Secret URL after that RocketChat/feature-requests#295 feature will be implemented, i.e when new registered users will be associated with custom role, that restricted in permissions a lot.

Hi @ankar84
can you give some hints how you did the LDAP integration ?
I'm using OpenLDAP and is working well but cannot see any users in Rocket.Chat. Thanks

can you give some hints how you did the LDAP integration ?
I'm using OpenLDAP and is working well but cannot see any users in Rocket.Chat

Hi, @nunoguerreiro
It a little bit offtopic here but anyway.
There is no rocket science in LDAP integration and all in documentation and good explained it Admin UI.
To get users from LDAP you need to configure Admin UI => LDAP => Sync/Import and after configuration Press Execute Synchronization Now button, and be sure to configure Background Sync Interval because we see, that manual and background synchronizations not same (Background Sync Interval do more things).
You can DM me at open.rocket.chat for details.

I think the problem is here: https://github.com/RocketChat/Rocket.Chat/blob/develop/app/ui/client/views/app/invite.js#L16

In particular in this test: settings.get ('Accounts_RegistrationForm')! == 'Disabled'

What is the purpose of this test actually?

Hi, I have the same issue with RC 2.4.9. Any tip about that?

Version 2.4.9
Apps Engine Version 1.11.2
Database Migration  170
Database Migration Date August 14, 2020 9:26 PM
Installed at    August 14, 2020 1:43 PM
Uptime  4 days, 1 hours, 46 minutes, 22 seconds
Deployment ID   ipvErvqS5xkRSHG79
PID 986
Running Instances   1
OpLog   Enabled

Any tip about that?

Upgrade minimum to 3.2.0
Better on recent and modern 3.5.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mattlin picture mattlin  ยท  3Comments

sta-szek picture sta-szek  ยท  3Comments

Buzzele picture Buzzele  ยท  3Comments

djeber picture djeber  ยท  3Comments

royalaid picture royalaid  ยท  3Comments