Skip to content

Tips for implementing password reset? #99

Description

@tamarabernad

Hi, I would like to look into implementing the password reset functionality. Any hints and tips for that?
Thanks!

Activity

  1. yamill commented on Jan 31, 2016

    @yamill

    +1

  2. gfosco commented on Feb 1, 2016

    @gfosco
    Contributor

    Generally this has just a few parts:

    • An express route or a cloud function to handle a password reset submission, which queries for a user matching the username/email. Generate a one-time random code and save it somewhere along with the user... Email the user, using some mail provider, with a link.
    • An express route to handle the link, which takes the random code provided and searches for the user, validates it, and then presents them with the ability to provide a new password... Use the master key to override the password and save the user.

    If you have further questions let me know..

  3. barcodehawk commented on Feb 1, 2016

    @barcodehawk

    I have Xcode 7 IOS 9 Swift 2.1 project using Parse SDK, with already working signup email account activation ( email verification ) and reset password features. In the open source Parse Server, I don't see anywhere I can configure this email features when I migrate out of Parse hosting services. There seems no documentation about migration of this Parse hosted email feature anywhere either. What will happen to these existing hosted email features after migrating out of Parse to open source Parse Server hosted on AWS or Heroku as is? How can I configure to make these working again?

  4. gfosco commented on Feb 1, 2016

    @gfosco
    Contributor

    They are not yet implemented in parse-server so are currently unavailable until developed.

  5. tamarabernad commented on Feb 1, 2016

    @tamarabernad
    Author

    @gfosco Sounds, good thanks for your hint

  6. natario1 commented on Feb 1, 2016

    @natario1

    @gfosco would you say these are "going to come"? Like you did, for example, for push and dashboard.

  7. corbanb commented on Feb 16, 2016

    @corbanb
    Contributor

    @gfosco is this password reset not going to be added to the parse-server? all the code gen and user codes are the hardest part. Curious if your team will be sharing examples for this or anything besides your 2 sentences.

  8. gfosco commented on Feb 16, 2016

    @gfosco
    Contributor

    They are coming, as soon as the interface for mail adapters is nailed down. You can follow some discussion in #275. Look in the PRs and you'll see multiple competing implementations already.

  9. seryoni commented on Mar 27, 2016

    @seryoni

    I was able to the reset password use case to work with SimpleMailgunAdapter. I did have to debug some of the internals though.

    This is the mailgun code:

    var SimpleMailgunAdapter = require('parse-server/lib/Adapters/Email/SimpleMailgunAdapter');
    var simpleMailgunAdapter = new SimpleMailgunAdapter({
    apiKey: process.env.MAILGUN_KEY || '',
    domain: process.env.DOMAIN || '',
    fromAddress: process.env.MAILGUN_FROM_ADDRESS || ''
    });

    The tricky part was learning that the following arguments must be passed to the ParseServer ctor, otherwise you'll get different levels of failures:

    publicServerURL: process.env.PUBLIC_SERVER_URL || 'http://localhost:1337/parse'

    appName: process.env.APP_NAME || '<your app name?'

    emailAdapter: simpleMailgunAdapter

    I set publicServerURL to be the same as serverURL. Didn't really understand the need for both but if you don't set the publicServerURL it all doesn't work.

  10. flovilmart commented on Mar 27, 2016

    @flovilmart
    Contributor

    publicServerURL should be set when you deploy remotely to a full domain URL as he clients won't be able to access the serverURL if that one refers to locallhost

  11. klemenzagar91 commented on Jul 3, 2016

    @klemenzagar91

    Is there still an option to user some parse password reset web template, like it was before going open source? I don't no much about web pages, so it'll be great if there is some default page where the user can change password.

  12. otmezger commented on Aug 17, 2016

    @otmezger

    Is there a roadmap when password reset would be implemented in parse-server?

  13. flovilmart commented on Feb 15, 2017

    @flovilmart
    Contributor

    This is implemented and fully functional, as well as password reset pages etc..:

  14. 4 remaining items

  15. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    Thanks for taking a look at it. I've been thinking all this morning about it and I think it's a possibility that I may not have either installed it to the right folder (I'm supposed to install " parse-server-simple-mailgun-adapter " directly into my "parse-server" folder correct?), or perhaps I did not put the code in the right index.js file.

    Previously I've located my app, and found the index.js file for my app. So for example theres a folder called myAppFolder. Inside I see folders that read "ParseStarterProject-Swift", "ParseStarterProject", and "parse-server-example-master". In "parse-server-example-master", I see an index.js file and that was the index.js file I added the above code to.

    But now I'm wondering if I should be editing the index.js file found in "parse-server" folder > "spec" folder > index.spec.js file?

    Can anyone give me insight into the exact index.js file I should be editing?

  16. flovilmart commented on Jul 7, 2017

    @flovilmart
    Contributor

    you should not have the specs in your parse-server installation. How did you install parse-server? Did you use parse-server-example?

  17. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    I did, back in January. I followed the migration guide.

  18. flovilmart commented on Jul 7, 2017

    @flovilmart
    Contributor

    ok, to install the mail adapter, did you run npm install --save parse-server-simple-mailgun-adapter

  19. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    Yes in this way:

    "
    Felecias-iMac:~ feleciacoleman$ cd parse-server
    Felecias-iMac:parse-server feleciacoleman$ npm i parse-server-simple-mailgun-adapter
    [email protected] /Users/feleciacoleman/parse-server
    └── [email protected]

    Felecias-iMac:parse-server feleciacoleman$

    "

    it is correct to install this directly in the parse-server directory, yes?

  20. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    And actually, after doing some digging it appears I might have installed parse-server from "https://github.com/parse-community/parse-server" as opposed to "https://github.com/parse-community/parse-server-example" ... that would explain why I have the spec folder :/
    could that really be causing this problem? I am able to effectively run/view my parse-dashboard and have been for months.

  21. flovilmart commented on Jul 7, 2017

    @flovilmart
    Contributor

    how did you install it? did you clone the repository and deploy that? Did you follow the installation instructions?

  22. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    i ended up installing the parse server using homebrew. I followed those installation instructions as best as i could. I kept running into road blocks so I actually had to follow multiple different tutorials to get through all of the hurdles. It seemed that everything worked out because all of my data migrated and I was able to run the dashboard effectively, but by forgot password not working, now I'm wondering if I was wrong about thinking I installed it properly after all.

  23. flovilmart commented on Jul 7, 2017

    @flovilmart
    Contributor

    i ended up installing the parse server using homebrew

    I'm not aware you can install parse-server with homebrew, there is plenty of documentation for installing and setting up, I'm not sure what steps your used to install therefore I can't say what's right or wrong...

  24. flovilmart commented on Jul 7, 2017

    @flovilmart
    Contributor
    $ brew search parse-server
    No formula found for "parse-server".
    

    Not even sure how you got there...

  25. FeleciaGenet commented on Jul 7, 2017

    @FeleciaGenet

    you are right, in my case I needed to do a few steps (installing node & mongodb) prior to installing parse server that i used homebrew for, then i cloned the parse directory.

    I followed this tutorial here https://www.raywenderlich.com/146736/parse-server-tutorial-ios

    What would help me most is giving insight into which folders things are supposed to be downloaded into. For instance, the parse server tutorial link above says this: "Next, in the root folder of the Parse project, open index.js and replace the default database string with your MongoDB database URI:
    // Replace this
    var databaseUri = process.env.DATABASE_URI || process.env.MONGOLAB_URI;

    // With this
    var databaseUri = 'mongodb://:@ds017678.mlab.com:17678/tutorial-app';
    This configures Parse Server to talk to your mLab database."

    If getting parse server installed required me to locate the root folder of my parse project and edit the index.js file in there, my thought was that that is also the folder where i need to install mailgun adapter and add the email adaptor options, however many posts on stackoverflow say that the file to where I edit the index.js and add the email adaptor options should be directly in the "parse-server" folder.

    What im saying is that I believe it's possible that my mailgun adapter installation may not be installed in the right folder, or perhaps i have not edited the proper index.js file. I think this is a directory location issue and it would be more effective for me to know what is correct versus asking you to do the ungodly task of trying to undo what ive done wrong (cause it could be many different things as I'm a newbie).

    thanks for spending time on this w me.

  26. crislucan commented on Jul 14, 2017

    @crislucan
  27. flinn commented on Jul 14, 2017

    @flinn

    @FeleciaGenet I might be wrong here, but I think you're coming at this from a WordPress background or something of the sort which is why you're confused about the directory structures for installing modules/components of your app... Parse Server and other apps/frameworks built with the MEAN stack or NodeJS utilize NPM (the Node Package Manager) which automatically installs modules into the root directory of your project. By root directory, I mean the directory which you presumably setup as a repository in source control (Git, Mercurial, etc...) and it the place where your node_modules folder and the package.json file resides. From within that directory or any sub directory you can run the npm install PACKAGE_NAME --save command from a terminal window and it will install the package into the node_modules folder in a flat/de-nested way and update your package.json file to reflect the package being installed (assuming you have that --save flag)... Essentially you should never have to go into node_modules/parse-server and run any installation commands or change code/configurations there. Due to the way that NodeJS's global require('package-name') command works, the parse-server code will be able to find and utilize the parse-server-simple-mailgun-adapter code once you've installed both packages via NPM and you've configured the code in your app as the instructions indicate... It's basically safe to say that tampering with any of the code/folders within your node_modules folder is a bad idea, especially if your app is in source control and might be shared with other developers as it is recommended that you ignore the node_modules folder from source control (like add it to your .gitignore file) in MOST cases... So if another developer cloned your codebase they would have to reinstall the modules and wouldn't get any of the changes you made locally in the ignored folder.

  28. adamofsky commented on Jul 17, 2017

    @adamofsky

    Please help reset user password!
    var api = new ParseServer({
    databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: process.env.APP_ID || 'myAppId',
    verifyUserEmails: false, //depends on your needs, you can set it to false
    emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds)
    preventLoginWithUnverifiedEmail: false, // defaults to false

    publicServerURL: 'https://a.herokuapp.com/parse',
    // Your apps name. This will appear in the subject and body of the emails that are sent.
    appName: 'APP',
    // The email adapter
    emailAdapter: {
    module: 'parse-server-simple-mailgun-adapter',
    options: {
    // The address that your emails come from
    fromAddress: '[email protected]',
    // Your domain from mailgun.com
    domain: 'https://api.mailgun.net/v2/mg.a.com/messages',
    // Your API key from mailgun.com
    apiKey: 'key-aaaaaaaaaaaa'
    // Your API key from mailgun.com
    }
    },

    The server works perfectly(all data loaded as well)
    Mailgun works perfectly(sending emails from terminal works like a charm)

    When I try to reset password I have in log:
    2017-07-17T22:20:06.550173+00:00 heroku[router]: at=info method=POST path="/parse/requestPasswordReset" host=a.herokuapp.com request_id=ff60cd44-6557-464c-9f17-aaaaaaaaa fwd="12.345.678.90" dyno=web.1 connect=1ms service=77ms status=200 bytes=483 protocol=https
    And nothing happen

    What I am doing wrong ?????
    If I will remove the appName I will see in the log:
    An appName, publicServerURL, and emailAdapter are required for password reset functionality.' } code=1, message=An appName, publicServerURL, and emailAdapter are required for password reset functionality.
    If I will request reset for wrong user I will see in the log:
    2017-07-17T22:27:23.340663+00:00 app[web.1]: message: 'No user found with email [email protected].' } code=205, message=No user found with email [email protected].
    2017-07-17T22:27:23.349814+00:00 app[web.1]: [object Object]

    It is mean that everything is worked BUT IT IS NOT SENDING THE EMAIL
    Thank you for response.

  29. amitkh6 commented on Jul 16, 2018

    @amitkh6

    @adamofsky did you able to sort this out, today I am in the same situation like yours.

    MailAdapter works fine with terminal/nmp however not able to setup in my app for password reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions