Page MenuHomePhabricator

D12830.id42631.diff
No OneTemporary

D12830.id42631.diff

diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs
--- a/services/identity/src/client_service.rs
+++ b/services/identity/src/client_service.rs
@@ -504,40 +504,21 @@
let user_id = if let Some(user_id) = self
.client
- .get_user_id_from_reserved_usernames_table(&wallet_address)
+ .get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet)
.await
.map_err(handle_db_error)?
{
- // It's possible that the user attempting login is already registered
- // on Ashoat's keyserver. If they are, we should try to register them if
- // they're on a mobile device, otherwise we should send back a gRPC status
- // code instructing them to try logging in from a mobile device first.
- if platform_metadata.device_type.to_uppercase() != "ANDROID"
- && platform_metadata.device_type.to_uppercase() != "IOS"
- {
- return Err(tonic::Status::permission_denied(
- tonic_status_messages::RETRY_FROM_NATIVE,
- ));
- };
-
- let social_proof =
- SocialProof::new(message.siwe_message, message.siwe_signature);
-
self
.check_device_id_taken(&flattened_device_key_upload, Some(&user_id))
.await?;
self
.client
- .add_wallet_user_to_users_table(
+ .add_user_device(
+ user_id.clone(),
flattened_device_key_upload.clone(),
- wallet_address.clone(),
- social_proof,
- Some(user_id.clone()),
platform_metadata,
login_time,
- message.farcaster_id,
- None,
)
.await
.map_err(handle_db_error)?;
@@ -546,7 +527,7 @@
} else {
let Some(user_id) = self
.client
- .get_user_id_from_user_info(wallet_address.clone(), &AuthType::Wallet)
+ .get_user_id_from_reserved_usernames_table(&wallet_address)
.await
.map_err(handle_db_error)?
else {
@@ -555,17 +536,36 @@
));
};
+ // It's possible that the user attempting login is already registered
+ // on Ashoat's keyserver. If they are, we should try to register them if
+ // they're on a mobile device, otherwise we should send back a gRPC status
+ // code instructing them to try logging in from a mobile device first.
+ if platform_metadata.device_type.to_uppercase() != "ANDROID"
+ && platform_metadata.device_type.to_uppercase() != "IOS"
+ {
+ return Err(tonic::Status::permission_denied(
+ tonic_status_messages::RETRY_FROM_NATIVE,
+ ));
+ };
+
+ let social_proof =
+ SocialProof::new(message.siwe_message, message.siwe_signature);
+
self
.check_device_id_taken(&flattened_device_key_upload, Some(&user_id))
.await?;
self
.client
- .add_user_device(
- user_id.clone(),
+ .add_wallet_user_to_users_table(
flattened_device_key_upload.clone(),
+ wallet_address.clone(),
+ social_proof,
+ Some(user_id.clone()),
platform_metadata,
- chrono::Utc::now(),
+ login_time,
+ message.farcaster_id,
+ None,
)
.await
.map_err(handle_db_error)?;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 8:09 AM (19 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2610574
Default Alt Text
D12830.id42631.diff (3 KB)

Event Timeline