Login of the correct user

Hey, everybody. I have a problem with profiles. Logging a user in logs them in to the LAST CREATED ACCOUNT, not their own. It’s like this for all users: everyone who logs in is redirected(?) to the last created account.
Is a code needed or am I just setting something wrong ?
Thank you very much, I have been solving this for a few weeks now…

Hey if you are still experiencing this you may want to open a bug ticket Contact Wix

What do you mean Profiles?

Did you create your own custom database and used forms to collect data from people to create a custom profile page?

If yes, your database permissions and/and or logic flow is incorrect.

Screenshots of the page elements and code help.

codequeen , amandam -
Thanks for your help, I’ll zoom in on the problem.
“Have you created your own database and used forms to collect data from people to create your own profile page?” - Yes.
I can’t find an easy way to manage user profiles on Wix.
I’m in the site creation phase and what I need is for “a registered user to get to their profile, not the profile that was created on the site LAST”.
And even simpler: For him to log in, view his profile, and be able to edit or delete it. Nothing more.
The permissions settings are just “Site Members” and such, but none of that can be used.
I have my collection, the permissions can’t be pinpointed (see “site members” etc).
I haven’t used the code yet.
Otherwise, creating profiles works perfectly (see photo “Profiles”), so I’m a bit confused that such a basic thing doesn’t work (see photo “Profile”)
Could it be that Wix hasn’t thought of such an essential feature or am I so dumb that I just can’t find it? :smiley:
Thank you very, very much for the advice :slight_smile:

:-*

I will briefly describe the requirement for the functionality of the website:

  1. Newcomer registration + filling out a detailed form - submits.
  2. a page with a thank you and a link to his profile.
  3. His profile is displayed. But on the page of all profiles, it’s just placed on top to see him as a new one. (Up to here everything works perfectly).
  4. I created a page to manage his own profile - but it doesn’t work as it should. The corresponding logged in user does not see his profile, but the LAST CREATED PROFILE, which is undesirable.
    Key issues:
    I don’t know if the profile management page should be static or dynamic,
    Whether it should be linked to the CMS,
    How it can’t at least use the ID slug in the filter (which would solve the problem),
    So how to manage the profile owner’s login to his profile and editing it.
    Once again, thank you very much for the tips and explanations.

So if you created your own form and they filled it out after they registered—— while they were logged in —— then your website knows who filled out the form.

So open the dataset settings that is connected to the Edit Profile form and add a filter: Owner is logged in.

Thank you. That’s not it. I still can’t get over it.
The website should work as a simple advertising platform:

  1. Introduction,
  2. registration (email and password) and filling out a form,
  3. Wix itself creates a profile using a repeater (I have everything linked to the collection),
  4. When clicked, the personality profile is shown.

I test this by registering myself under some of my emails (I have several), choosing a password and then continuing on under that. If I run out of emails, I delete them from the collection and use them again.

Problems: I can’t set one thing - authorization of my own account. First of all, I don’t know if I need to use Wix members (but that is user-unacceptable) or if I can create my own login panel.
Second: I guess I need a dynamic page to log in and view my own profile, right? I already have one - it looks the same as a personal profile. I used the “Login Panel” to log in. But nothing happens on the real site. Yet in the editor, I get this small, narrow, drop-down panel where “Switching between different emails” shows the CORRECT ACCOUNT. It’s probably a triviality, but even using ChatGPT didn’t solve the problem.

The whole login and logout system just doesn’t work as it should and it’s the only problem I can’t solve.

In the collection, all the data is stored correctly.
It’s very likely that I have an error somewhere in the editor settings, in permissions, in privacy, or have forgotten something.

If you can take a look at it in person, it would be a small victory for me. I’ve been dealing with this myself for months and it’s cost me all my savings.. :confused:

I can send my login details on request if you can help.

Thank you for your understanding

Hi, @Ronald_Horn !!

Hello. Are you saying that you haven’t used any code at this point? :upside_down_face: Just my personal opinion, but if the system is logging in with the most recently added account, that seems like a potentially serious issue. However, this likely only applies if you’re using Wix’s built-in login system. It’s possible that the login itself is completing correctly, but the wrong page is being displayed afterward. :melting_face: Showing the page for the most recently added account is a type of error that’s relatively easy to imagine. :innocent:

If you’re able to add some code, I recommend trying the sample code provided in the reference below. This code will allow you to check who is currently logged in. I think it would be best to start by confirming whether the login is actually working correctly. :wink:


import { currentMember } from "wix-members-frontend";

currentMember
  .getMember()
  .then((member) => {
    console.log(member.loginEmail);
  })
  .catch((error) => {
    console.error(error);
  });

Paste this code into the code panel of your page (profile page you made), then publish the site. After that, access the page in your browser and check the logs in the browser’s developer console. If you see the email address of the logged-in user displayed there, it means the login itself is working correctly. :smiling_face_with_sunglasses:

Thank you. I did as you said and this was in the console (but there was no user logged in, although I did log in):

"The resource was preloaded using link preload but not used within a few seconds from the window’s load event. Please make sure it has an appropriate as value and it is preloaded intentionally.

Chrome is moving towards a new experience that allows users to choose to browse without third-party cookies."


Otherwise I went through the whole dev mode and there is no code inserted anywhere.

You know - honestly:
I spent over a year teaching myself with Wix.
I’ve basically got everything I need done.
But I’ve been working on this for a few months now, and I confess that I no longer believe that I’m going to see it through to a successful conclusion.

I’d be happy if someone could ‘fix’ it remotely, because I’ve tried forums, ChatGPT, all the advice on Wix I’ve gone through from A to Z and it still stands unfinished..

That’s all. Thank you.

Sorry, I made a small mistake. :melting_face: Could you try again using this code I’ve pasted? :innocent:


import { currentMember } from "wix-members-frontend";

$w.onReady(function () {

  currentMember
    .getMember()
    .then((member) => {
      console.log(member);
      console.log(member.loginEmail);
    })
    .catch((error) => {
      console.error(error);
    });

});

Thank you. I have pasted the new code and there is showing in the console this error:

instrument.js:109 TypeError: cannot read properties of undefined (reading ‘loginEmail’)
at eval (awjdp.js:9:26)

In addition, I had to restart this forum several times - I couldn’t post replies.

I plan to expand the project by hundreds of thousands of people, but if I don’t get it together, I’ll move away from Wix and try it on another platform.

I see. Then, wasn’t there something displayed above the error saying that loginEmail couldn’t be read? :thinking:

Error: Uncaught Error: [mobx] An invariant failed, however the error is obfuscated because this is an production build.
at Worker. (platformWorkerInitializer.ts:59:26)
helpers.js:88 Uncaught Error: [mobx] An invariant failed, however the error is obfuscated because this is an production build.
at Mt (mobx.module.js:2652:15)
at Bt (mobx.module.js:2647:5)
at eval (mobx.module.js:2877:17)
at n (helpers.js:72:23)Nechte si tuto chybu vysvětlit
12The resource was preloaded using link preload but not used within a few seconds from the window’s load event. Please make sure it has an appropriate as value and it is preloaded intentionally.Nechte si toto upozornění vysvětlit
instrument.js:109 Running the code for the Upravit profil page. To debug this code in your browser’s dev tools, open awjdp.js.
instrument.js:109 Error: Fetching asset failed with status code [404] https://static.parastorage.com/services/members-area-notifications/1.21.0/NotificationsController.bundle.min.js
at fetchEval.ts:10:9
at async Object.loadModule (amdLoader.ts:98:12)
(anonymní) @ instrument.js:109Nechte si tuto chybu vysvětlit
fetchEval.ts:10 Uncaught (in promise) Error: Fetching asset failed with status code [404] https://static.parastorage.com/services/members-area-notifications/1.21.0/NotificationsController.bundle.min.js
at fetchEval.ts:10:9
at async Object.loadModule (amdLoader.ts:98:12)Nechte si tuto chybu vysvětlit
instrument.js:109 Object
instrument.js:109 ******@seznam.cz
instrument.js:109 Running the code for the Vlastní stránka pro členy page. To debug this code in your browser’s dev tools, open mmhpq.js.
instrument.js:109 Chyba při načítání profilu: F: WDE0025: The Data uzivatelu - moje! collection does not exist.
at W (https://static.parastorage.com/services/wix-thunderbolt/dist/feature-data-wix-code-sdk.a191702e.chunk.min.js:1:15133)
at x (https://static.parastorage.com/services/wix-thunderbolt/dist/feature-data-wix-code-sdk.a191702e.chunk.min.js:1:15054)
at lt (https://static.parastorage.com/services/wix-thunderbolt/dist/feature-data-wix-code-sdk.a191702e.chunk.min.js:1:58554)
at https://static.parastorage.com/services/wix-thunderbolt/dist/feature-data-wix-code-sdk.a191702e.chunk.min.js:1:57828

Something is written there in Czech (Error loading profile). Very Thanks.

You know, it would be easiest for me to make the account login details available and the person in question would look at everything related to this issue. Of course, I also respect the cost of the work and that’s why I try to get a solution as quickly as possible. Thanks

I see. By the way, is the name of the collection where member information is stored on your site “PrivateMembersData”? :thinking:

Actually, I’ve been thinking about something you said earlier: “I don’t know if I need to use Wix members (but that is user-unacceptable) or if I can create my own login panel.” The reason this stood out to me is because the code I’m using assumes that you’re working with Wix’s built-in member system.

That’s why I believe the first thing we should do is check whether your site has a collection named “PrivateMembersData”. This collection is automatically added when you use Wix’s member system, so its presence (or absence) will help clarify where things currently stand with your setup.

If this collection doesn’t exist, I believe the code won’t work as expected. :slightly_smiling_face:

Thanks for the clarification!

After my initial experience with the very limited options of Wix’s preset services, I made everything my own - including the collection. It turned out to be a good move, since you’re basically unlimited in scaling the project. And yes, you’re probably right :slight_smile:
My collection has a different name (in Czech “Data uživatelů - moje!”)
In this collection everything is - so far - functional, so in short:
When a new user registers and fills out a detailed form about himself, the collection stores this data correctly and even Wix automatically generates a unique ID for each user, which is great :slight_smile: But when I want to use this feature (unique ID) to filter or better to identify for login, it doesn’t work - the settings menu shows the ID (text) but not the ID slug (which I have).
So I tried to identify by email, but again the settings behave non-standardly: it wants to specify exactly “Which email?” and this is of course nonsense, because it links all profiles to one email.
So I guess. It seems to me that there is an “overlap” of automatic settings with manual ones, but I don’t know.
All I need is to identify the logged in user, nothing more.
It seems like a superhuman task, which is surprising considering that almost everything can be done at Wix otherwise :slight_smile:

So much for the whole problem, I guess.
Thanks for the tips, you are kind :slight_smile:

1 Like

I see. :wink: so you’re building a custom login system using your own collection. I don’t think I’ve come across anyone in this community who has done that, but I just wanted to say that it can potentially lead to serious issues if not implemented very carefully, so I’m a little concerned.

If you’re storing passwords directly in your collection, that’s not considered a good practice. While we can’t be certain how things work behind the scenes in Wix, typically, passwords are stored in a hashed and encrypted form. That’s the standard approach in most secure systems.

So, while you may not be looking for this suggestion, I personally think it’s better to use Wix’s built-in login system. Not only does it offer great extensibility through code, but by sticking to standard practices, you’ll also find it easier to get help from the community.

In fact, even after several exchanges with you, I still don’t have a full picture of how your custom login system works. Since login functionality is one of the most fundamental aspects of any website, most of the features people need are already provided as APIs — and that includes Wix as well.

Because the responsibilities of a login system are so well-established, there’s usually not much room — or need — for originality. That may sound a little boring, but both the community and Wix Support will most likely assume you’re using the standard methods when discussing login-related issues.

I suspect the forum members who answered you earlier were also responding under that assumption.
As for your goal of “identifying the currently logged-in user,” the simple code I shared earlier should be enough for basic implementation. If you’re interested, you might want to give the standard Wix method a try, just to see how it works.

One of the advantages of using the standard method is that even if I were to leave this community tomorrow, you’d still be able to find someone who can help you.

Of course, it’s entirely up to you whether you go that route or not. :innocent:

Thank you.
But with Wix’s default login system, I can’t edit the form to my exact specifications. That’s why I dropped it as well.
The first thing I noticed about it was that it somehow automatically linked the account to a social media account, and I could tell by the updated profile photo.
I didn’t find an option to unlink it even after a long time. The whole site will be more or less anonymised to avoid discrimination, whether on the basis of nationality, colour, age or social status, so it is also undesirable for an account to be linked to external social networks, let alone a name.
Another problem I encountered was the very limited graphical editing capabilities of this preset account.
However, I admit that it is possible that I just didn’t find the right steps to edit.
So I’ll give this preset another try, but I’m getting pretty desperate about the whole thing.