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

adminUserCreate does not confirm accounts regardless of confirm parameter #185

Closed
Auspicus opened this issue Sep 19, 2018 · 3 comments
Closed
Labels

Comments

@Auspicus
Copy link

Auspicus commented Sep 19, 2018

- 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.

  • Send a POST request to /.netlify/identity/admin/user with valid user information and "confirm" true

  • Try to log into user account

  • Note "User is not confirmed" error

  • Send a POST request to /.netlify/identity/admin/user with valid user information and no "confirm"

  • No confirmation email is sent

- What is the expected behavior?

  • Send a POST request to /.netlify/identity/admin/user with valid user information and "confirm" true

  • Try to log into user account

  • Account should be confirmed and be allowed to log in

  • Send a POST request to /.netlify/identity/admin/user with valid user information and no "confirm"

  • Confirmation email should be sent

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

Running on netlify.com

@Auspicus
Copy link
Author

Auspicus commented Sep 19, 2018

I have a PR which I think will address the issue #184

if terr := user.Confirm(tx); terr != nil {

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

@github-actions
Copy link

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 github-actions bot added the stale label Apr 24, 2021
@github-actions
Copy link

github-actions bot commented May 1, 2021

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

@github-actions github-actions bot closed this as completed May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant