Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse.User.logIn or UserSubclass.logIn does not return a subclass instance #263

Closed
codebreach opened this issue Apr 25, 2016 · 8 comments
Closed
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@codebreach
Copy link

codebreach commented Apr 25, 2016

    class CustomUser extends ParseUser {
      customMethod() {
        return 'a';
      }
    }
    ParseObject.registerSubclass(ParseUser.className, CustomUser);
    CustomUser.logIn('username', 'password').then((u) => {
      expect(u instanceof CustomUser).toBe(true);
      expect(u.customMethod()).toBe('a');
    });

Failing test case:
drinklynk@0a9fa9c

@andrewimm
Copy link
Contributor

Interesting. Seems like rather than instantiating a new ParseUser directly, we want to use the className approach and create a new ParseObject('_User').
This might get a little tricky with the user class rewrite flag, but I'll look into this.

@dpoetzsch
Copy link

Same problem seems to exist with User.become

@fmendoza
Copy link

Any workaround for this issue?

@flovilmart
Copy link
Contributor

This hasn’t been addressed yet, but further investigation would be appreciated

@fmendoza
Copy link

I found a way to do it

let user = new MyCustomUserClass;
user.username = 'johndoe';
user.password = 'secret';
user.logIn(null).then(obj => {
/// obj is an instance of MyCustomUserClass

@gcysne
Copy link

gcysne commented Apr 22, 2018

Thanks fmendoza, this workaroud is really helpfull.

@dplewis dplewis added the type:bug Impaired feature or lacking behavior that is likely assumed label Sep 14, 2018
@awgeorge
Copy link

This workaround seems to no longer work with parse server v3 as we get username/email is required, @fmendoza can you confirm?

@fmendoza
Copy link

fmendoza commented Feb 6, 2019

Still working on my end with Parse Server v3 and Parse SDK JS 2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

8 participants