Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3081

app.login (Email/Password) issue

    • Type: Icon: Bug Bug
    • Resolution: Declined
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Problem Statement/Rationale

      I have two users-id and I am testing the log-out and log-in as different users (from my html5 application) to make sure my app works correctly. Most of the time it is working fine but randomly it logs in as the previously logged-in user.

      Steps to Reproduce

      Create a html5/JS application and implement the code to login (code given below) to Realm app.

      1. User A logs in
      2. User A logs out
      3. User B Logs in. In Realm logs, I can see User B successfully authenticated
      4. After successful login, my app invokes Realm functions to get the data. At this point, it is getting the data of User A.
      5. I noticed that right after app.login is called, the variable app.currentUser is showing the _id of user B correctly but the email address is of user A instead of the current user which is user B. More specifically app.currentUser.profile.email gives the email of User A instead of user B. Note that this happens only randomly.

                      var user = app.logIn(credentials).then(function (oResponse)

      {                     window.console.log(app.currentUser);                     this.setCurrentLoggedInUser(app.currentUser);  //Here currentUser has the details of User A while User B is the one who just tried to login successfully. Also user.id is giving 'undefined'                      this.setAppObject(app);                     // `App.currentUser` updates to match the logged in user                     window.console.log("fn fetchUser: resolving");                     fnResolve(oResponse);                 }

      .bind(this)).catch(function (oError)

      {                     window.console.log("fn fetchUser: rejecting");                     window.console.log(oError);                     // fnReject(oError.errorCode);                     fnReject(oError);                 }

      .bind(this));

      Expected Results

      Each time a user logs-in via app.login, the return value (currentUser) should have the email address of the current logged-in user ..just like how it gives the _id.

      Actual Results

      Instead, the profile.email is giving the email address of previous logged-in user.

      Additional Notes

      See attached screenshots

        1. Return Value.png
          Return Value.png
          138 kB
        2. Value sent to app Login.png
          Value sent to app Login.png
          75 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            kumarkkrao@gmail.com Kumar K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: