diff --git a/keyserver/addons/rust-node-addon/rust-binding-types.js b/keyserver/addons/rust-node-addon/rust-binding-types.js --- a/keyserver/addons/rust-node-addon/rust-binding-types.js +++ b/keyserver/addons/rust-node-addon/rust-binding-types.js @@ -16,6 +16,7 @@ notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, + force: ?boolean, ) => Promise, +registerUser: ( username: string, diff --git a/keyserver/addons/rust-node-addon/src/identity_client/login.rs b/keyserver/addons/rust-node-addon/src/identity_client/login.rs --- a/keyserver/addons/rust-node-addon/src/identity_client/login.rs +++ b/keyserver/addons/rust-node-addon/src/identity_client/login.rs @@ -18,8 +18,9 @@ notif_prekey_signature: String, content_one_time_keys: Vec, notif_one_time_keys: Vec, + force: Option, ) -> Result { - debug!("Attempting to login user: {}", username); + debug!("Attempting to log in user: {}", username); // Set up the gRPC client that will be used to talk to the Identity service let mut identity_client = get_identity_client().await?; @@ -51,7 +52,7 @@ one_time_notif_prekeys: notif_one_time_keys, device_type: DeviceType::Keyserver.into(), }), - force: None, + force, }; debug!("Starting login to identity service"); diff --git a/keyserver/src/user/checks.js b/keyserver/src/user/checks.js --- a/keyserver/src/user/checks.js +++ b/keyserver/src/user/checks.js @@ -4,7 +4,8 @@ export type UserCredentials = { +username: string, +password: string, - +usingIdentityCredentials: boolean, + +usingIdentityCredentials?: boolean, + +forceLogin?: boolean, }; async function ensureUserCredentials() { diff --git a/keyserver/src/user/login.js b/keyserver/src/user/login.js --- a/keyserver/src/user/login.js +++ b/keyserver/src/user/login.js @@ -7,6 +7,7 @@ import { ServerError } from 'lib/utils/errors.js'; import { retrieveAccountKeysSet } from 'lib/utils/olm-utils.js'; +import type { UserCredentials } from './checks.js'; import { saveIdentityInfo, fetchIdentityInfo, @@ -15,8 +16,6 @@ import { getMessageForException } from '../responders/utils.js'; import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js'; -type UserCredentials = { +username: string, +password: string }; - // After register or login is successful function markKeysAsPublished(account: OlmAccount) { account.mark_prekey_as_published(); @@ -104,6 +103,7 @@ notificationsPrekeySignature, contentOneTimeKeys, notificationsOneTimeKeys, + userInfo.forceLogin, ); await Promise.all([ fetchCallUpdateOlmAccount('content', markKeysAsPublished), diff --git a/scripts/set-admin-data.js b/scripts/set-admin-data.js --- a/scripts/set-admin-data.js +++ b/scripts/set-admin-data.js @@ -34,6 +34,7 @@ username: credentials.username, password: credentials.password, usingIdentityCredentials: true, + forceLogin: true, }; const userCredentialsJSON = JSON.stringify(userCredentials, null, 2); const keyserverSecrets = 'keyserver/secrets';