netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.88k stars 288 forks source link

adminUserCreate does not confirm accounts regardless of confirm parameter #185

Closed Auspicus closed 3 years ago

Auspicus commented 6 years ago

- Do you want to request a feature or report a bug?

BUG

- What is the current behavior?

When sending a new user to /admin/user via POST the current behavior is that there is no confirmation email sent to the email of the user regardless of the "confirm" parameter.

exports.handler = (event, context, send) => {
  const { email, password } = event.body;
  const { identity } = context.clientContext;

  return fetch(`${identity.url}/admin/users`, {
    method: 'POST',
    headers: { Authorization: `Bearer ${identity.token}` },
    body: JSON.stringify({
      email,
      password,
      confirm: true, // confirm user automatically https://github.com/netlify/gotrue/blob/d514884c1465d64b4e591117d13d542f9bc36fc6/api/admin.go#L209-L213
      user_metadata: {
        test: "test"
      }
    })
  })
  .then(response => {
    return response.json();
  })
  .then(() => {
    send(null, {
      statusCode: 204,
      body: JSON.stringify({
        message: `Created user ${email}`
      })
    });
    return;
  })
  .catch(console.error);
}

- If the current behavior is a bug, please provide the steps to reproduce.

- What is the expected behavior?

- Please mention your Go version, and operating system version.

Running on netlify.com

Auspicus commented 6 years ago

I have a PR which I think will address the issue https://github.com/netlify/gotrue/pull/184

https://github.com/netlify/gotrue/blob/8d7090e0d95bd750687f40d7288fc725fa03708b/api/admin.go#L210

I'm not sure why the Confirm function is not confirming the user.

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 7 days if no further activity occurs. Thanks!

github-actions[bot] commented 3 years ago

This issue was closed because it had no activity for over 1 year.