How do I reset a user's password?

I am the owner however I cannot see how to reset a user’s password?

I clicked the link at login however no email was received.

I am using the DigitalOcean installation.

The (only) way to reset a password is using the reset password button. If e-mails are not working, you can follow this other thread, perhaps it gives you some hints. It’s also worth checking the logs of your celery container to see if the e-mail was sent.

Thanks but no idea how. I have the CLI open but not sure what command:

  1. dmesg
  2. cat /var/log/syslog
  3. celery -A tasks worker --loglevel=info
docker-compose logs --tail 100 grampsweb_celery
1 Like

ERROR:
Can’t find a suitable configuration file in this directory or any
parent. Are you in the right directory?

    Supported filenames: docker-compose.yml, docker-compose.yaml

found the correct folder :slight_smile:

Here’s what the logs show:

grampsweb_celery | [2023-12-17 02:34:19,842: INFO/MainProcess] mingle: searching for neighbors
grampsweb_celery | [2023-12-17 02:34:20,869: INFO/MainProcess] mingle: all alone
grampsweb_celery | [2023-12-17 02:34:20,904: INFO/MainProcess] celery@3d74385087a7 ready.
grampsweb_celery | [2023-12-17 03:07:08,429: INFO/MainProcess] Task gramps_webapi.api.tasks.send_email_reset_password[8ef9dc18-d1ee-4bba-a82f-ec35fc2adf8e] received
grampsweb_celery | [2023-12-17 03:07:08,533: WARNING/ForkPoolWorker-1] [2023-12-17 03:07:08,530] ERROR in util: Error while trying to send e-mail.
grampsweb_celery | [2023-12-17 03:07:08,530: ERROR/ForkPoolWorker-1] Error while trying to send e-mail.
grampsweb_celery | [2023-12-17 03:07:08,687: ERROR/ForkPoolWorker-1] Task gramps_webapi.api.tasks.send_email_reset_password[8ef9dc18-d1ee-4bba-a82f-ec35fc2adf8e] raised unexpected: ValueError(‘Error while trying to send e-mail.’)
grampsweb_celery | Traceback (most recent call last):
grampsweb_celery | File “/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/util.py”, line 398, in send_email
grampsweb_celery | smtp = smtplib.SMTP_SSL(host=host, port=port, timeout=10)
grampsweb_celery | File “/usr/lib/python3.9/smtplib.py”, line 1034, in init
grampsweb_celery | SMTP.init(self, host, port, local_hostname, timeout,
grampsweb_celery | File “/usr/lib/python3.9/smtplib.py”, line 253, in init
grampsweb_celery | (code, msg) = self.connect(host, port)
grampsweb_celery | File “/usr/lib/python3.9/smtplib.py”, line 339, in connect
grampsweb_celery | self.sock = self._get_socket(host, port, self.timeout)
grampsweb_celery | File “/usr/lib/python3.9/smtplib.py”, line 1040, in _get_socket
grampsweb_celery | new_socket = super()._get_socket(host, port, timeout)
grampsweb_celery | File “/usr/lib/python3.9/smtplib.py”, line 310, in _get_socket
grampsweb_celery | return socket.create_connection((host, port), timeout,
grampsweb_celery | File “/usr/lib/python3.9/socket.py”, line 843, in create_connection
grampsweb_celery | raise err
grampsweb_celery | File “/usr/lib/python3.9/socket.py”, line 831, in create_connection
grampsweb_celery | sock.connect(sa)
grampsweb_celery | OSError: [Errno 99] Cannot assign requested address
grampsweb_celery |
grampsweb_celery | During handling of the above exception, another exception occurred:
grampsweb_celery |
grampsweb_celery | Traceback (most recent call last):
grampsweb_celery | File “/usr/local/lib/python3.9/dist-packages/celery/app/trace.py”, line 477, in trace_task
grampsweb_celery | R = retval = fun(*args, **kwargs)
grampsweb_celery | File “/usr/local/lib/python3.9/dist-packages/gramps_webapi/util/celery.py”, line 20, in call
grampsweb_celery | return self.run(*args, **kwargs)
grampsweb_celery | File “/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/tasks.py”, line 68, in send_email_reset_password
grampsweb_celery | send_email(subject=subject, body=body, to=[email])
grampsweb_celery | File “/usr/local/lib/python3.9/dist-packages/gramps_webapi/api/util.py”, line 417, in send_email
grampsweb_celery | raise ValueError(“Error while trying to send e-mail.”)
grampsweb_celery | ValueError: Error while trying to send e-mail.

I expect the error is because the mail server settings have not been set however I am unsure of where to set these?

Hi,
unfortunately, the way the DigitalOcean Gramps Web app is currently set up, it is not easy to modify the e-mail configuration after the first setup, because it cannot be done from the web interface. You will have to manually query the API to change the configuration, as described here

https://www.grampsweb.org/dev-backend/queries/

the relevant commands are

http -A bearer -a $ACCESS_TOKEN PUT https://your-hostname/api/config/EMAIL_HOST value=smtp.mymailserver.com

and so on for the other options. I know, it’s annoying.

Thanks David, I am now thinking that I have set this up to the hardway. Is email configured during the initial setup which I have skipped/missed? Maybe it would be easier to backup my config, reinstall with email configured and then restore my config?

Hi, on a single-tree setup like DigitalOcean, there are two ways to configure e-mail: either in the config file/environment (see here) or via the form shown when you first open the app. When you use the config file or environment, you can just leave the form empty.

Unfortunately, this has a couple of shortcomings at present:

  • when you use the form (which means the config is stored in the database), it is currently not possible to change it via the UI, as you already found out
  • currently there is no validation of the settings, e.g. no test e-mail can be sent

In your current situation, another option (rather than reinstalling or using manual API queries) would be to empty the config table in the user database. For this you would have to run a container

cd /opt/grampsweb
docker-compose run --rm grampsweb bash
sqlite3 /app/users/users.sqlite
DROP TABLE IF EXISTS config;
.quit

(not 100% sure commands are correct, haven’t tested).

After removing this table (which just removes the email config), you can add the email config to docker-compose.yaml as environment variables.

1 Like