[gnome-notes/fix-nextcloud-user-domain: 8/8] nextcloud-provider: change how to get user domain
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes/fix-nextcloud-user-domain: 8/8] nextcloud-provider: change how to get user domain
- Date: Mon, 14 Jun 2021 02:43:12 +0000 (UTC)
commit 2e3ff9f0aad223e5f917f03338cf949638511c65
Author: Isaque Galdino <igaldino gmail com>
Date: Wed Jun 9 10:07:39 2021 -0300
nextcloud-provider: change how to get user domain
In the past, the NextCloud user and domain(server) information were used
for display only.
With the change to call the NextCloud REST API directly, that
information is also used to authenticate the user with the cloud provider.
There was an issue when we had a '@' in the user id, e.g. user@email
because the code was extracting that from the GOA presentation identity
field which concats the user with the domain using a '@' as well, e.g.
user@email@domain.
When the code was split it to get user and domain, the information was
messed up with user being 'user' and domain being 'email@domain'.
Fix issue #171
src/libbiji/provider/biji-nextcloud-provider.c | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
---
diff --git a/src/libbiji/provider/biji-nextcloud-provider.c b/src/libbiji/provider/biji-nextcloud-provider.c
index 9ca091ae..f65b2712 100644
--- a/src/libbiji/provider/biji-nextcloud-provider.c
+++ b/src/libbiji/provider/biji-nextcloud-provider.c
@@ -233,7 +233,6 @@ constructed (GObject *object)
BijiNextcloudProvider *self = (BijiNextcloudProvider *)object;
GoaAccount *account = NULL;
const char *goa_id;
- g_auto(GStrv) bjb_id = NULL;
GoaPasswordBased *goa_pass = NULL;
g_autoptr (GIcon) icon = NULL;
g_autoptr (GError) error = NULL;
@@ -258,27 +257,14 @@ constructed (GObject *object)
self->info.unique_id = goa_account_get_id (account);
self->info.datasource = g_strdup_printf ("gn:goa-account:%s", self->info.unique_id);
self->info.name = g_strdup (goa_account_get_provider_name (account));
+ self->info.user = goa_account_dup_identity (account);
goa_id = goa_account_get_presentation_identity (account);
if (goa_id)
- {
- bjb_id = g_strsplit (goa_id, "@", 2);
- if (bjb_id[0])
- {
- self->info.user = g_strdup (bjb_id[0]);
- if (bjb_id[1])
- self->info.domain = g_strdup (bjb_id[1]);
- }
- }
- if (!self->info.user || !self->info.domain)
- {
- biji_provider_abort (BIJI_PROVIDER (self));
- return;
- }
+ self->info.domain = g_strdup (g_strrstr (goa_id, "@") + 1);
- if (!goa_account_call_ensure_credentials_sync (account, NULL, NULL, NULL))
+ if (!self->info.user || !self->info.domain)
{
- g_debug ("FAILED: goa_account_call_ensure_credentials_sync");
biji_provider_abort (BIJI_PROVIDER (self));
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]