Skip to content

Conversation

@abought
Copy link
Contributor

@abought abought commented Oct 11, 2016

Ticket: https://openscience.atlassian.net/browse/LEI-237

Purpose

Allow password reset / new user emails from JamDB to reference the user associated with this action.

Previously, the only variable available to sendgrid was the token.

Checklist

Behavior:

  • Include correct user id (eg "abought1") in email templates
  • Sendgrid can act on this substitution in templates, where appropriate
  • Sendgrid can ignore unused substitutions, where appropriate
  • Verify emails are correctly formatted and display values as expected

Documentation

  • Get unit tests passing
  • Document how to contribute and how to run tests

How to test this

  • Create a JamDB project with an accounts collection. Add the following attributes to the collection to enable login and email behaviors (providing your own sendgrid key and template ID as appropriate)
    attrs: {
        ...
      schema: {
        "type": "jsonschema",
        "schema": {
          "type": "object",
          "required": [
            "password"
          ],
          "id": "/",
          "properties": {
            "password": {
              "id": "password",
              "pattern": "^\\$2b\\$1[0-3]\\$\\S{53}$",
              "type": "string"
            }
          }
        }
      },
...
        plugins: {
            user: {
              fromEmail: "spammer-catapult@nospam.com",
              sendgridKey: "SG.DangerWillRobinson",
              createdIsOwner: true,
              template: "a-b-c-d-e"
            }
      },
    }

A sample SendGrid template would be:

Hi, :unspecifiedsubst ,

Your user id is:  :user

You have a token, but this email doesn't tell you what it is. In conclusion, yay dinosaurs!

Then send a password request- if you use Lookit, the app will do this for you. The email should contain the user ID ("abought1") for the relevant account in place of the :user field.

@abought abought changed the title Send user ID to sendgrid, for optional use by email templates [WIP] Send user ID to sendgrid, for optional use by email templates Oct 11, 2016
@abought abought changed the title [WIP] Send user ID to sendgrid, for optional use by email templates Send user ID to sendgrid, for optional use by email templates Oct 11, 2016
@abought abought changed the title Send user ID to sendgrid, for optional use by email templates [rfr] Send user ID to sendgrid, for optional use by email templates Oct 11, 2016
@chrisseto chrisseto merged commit f2a68bb into CenterForOpenScience:develop Oct 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants