Reset password email sent, but activation email don't

Hello!

I am trying the Tutor for the first time but I have a problem with the activation email for a new account.

Using the “tutor config --set” commands, I configured the following parameters in the config.yml file:

SMTP_HOST: smtp.gmail.com
SMTP_PASSWORD: my_password
SMTP_PORT: 587
SMTP_USERNAME: my_user_email
SMTP_USE_TLS: true

I restarted Tutor normally but I have the following problem: password reset emails are sent normally, but activation emails for a new user account are not. So the following situation is occurring:

  1. A new user registers with an email and password (without using the login options via Facebook or Google), and the Tutor displays a message saying that the user needs to confirm the account via an activation email.

  2. This activation email is not sent (I don’t know why).

  3. The new user is unable to log into your account, as the account has not been activated.

  4. If the new user clicks on the option to perform a password reset, NOW he receives the email for the password reset normally.

  5. If the user clicks on the password reset email and follows the procedure to create his password again, in addition to changing the password, Tutor activates the user’s account. Now the user can log in.

So, from my point of view, the SMTP configuration is correct because the password reset email is sent normally. But somehow, there is a problem with sending the account activation email, even with the correct SMTP settings.

This problem can be verified directly: register at https://cursos.magister.pro.br (it is a test site, there are no courses on it) and you will not receive the activation email; click reset password and you will receive the email.

If possible, I would like a help to fix this activation e-mail problem.

Thank you!

1 Like

Good catch @abrantesasf! I manage to reproduce the issue. Here are the logs:

rabbitmq_1        | =INFO REPORT==== 22-Jun-2020::06:30:00 ===                                                                                                                               
rabbitmq_1        | connection <0.1172.0> (172.18.0.11:53478 -> 172.18.0.5:5672): user 'guest' authenticated and granted access to vhost '/'
cms-worker_1      | [2020-06-22 06:30:00,041: INFO/MainProcess] Received task: student.tasks.send_activation_email[2a0d56f9-73e5-433b-9d6f-0f5366316184]                                     
rabbitmq_1        |                          
rabbitmq_1        | =INFO REPORT==== 22-Jun-2020::06:30:00 ===                                                                                                                               
rabbitmq_1        | closing AMQP connection <0.1172.0> (172.18.0.11:53478 -> 172.18.0.5:5672, vhost: '/', user: 'guest')                                                                     
cms-worker_1      | [2020-06-22 06:30:00,087: ERROR/Worker-4] Unable to send activation email to user from "******@demo.openedx.overhang.io" to "******@behmo.com"
cms-worker_1      | Traceback (most recent call last):
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/defaulttags.py", line 1021, in find_library
cms-worker_1      |     return parser.libraries[name]
cms-worker_1      | KeyError: 'django_markup'
cms-worker_1      |
cms-worker_1      | During handling of the above exception, another exception occurred:
cms-worker_1      |
cms-worker_1      | Traceback (most recent call last):
cms-worker_1      |   File "/openedx/edx-platform/common/djangoapps/student/tasks.py", line 45, in send_activation_email
cms-worker_1      |     ace.send(msg)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/edx_ace/ace.py", line 58, in send
cms-worker_1      |     rendered_message = presentation.render(channel, msg)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/edx_ace/presentation.py", line 28, in render
cms-worker_1      |     return renderer.render(channel, message)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/edx_ace/renderers.py", line 45, in render
cms-worker_1      |     template = self.get_template_for_message(channel, message, filename)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/edx_ace/renderers.py", line 70, in get_template_for_message
cms-worker_1      |     return loader.get_template(template_path)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/loader.py", line 15, in get_template
cms-worker_1      |     return engine.get_template(template_name)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/backends/django.py", line 34, in get_template
cms-worker_1      |     return Template(self.engine.get_template(template_name), self)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/engine.py", line 143, in get_template
cms-worker_1      |     template, origin = self.find_template(template_name)
cms-worker_1      |     template = loader.get_template(name, skip=skip)
cms-worker_1      |   File "/openedx/edx-platform/common/djangoapps/edxmako/makoloader.py", line 45, in get_template
cms-worker_1      |     return self.load_template(template_name)
cms-worker_1      |   File "/openedx/edx-platform/common/djangoapps/edxmako/makoloader.py", line 71, in load_template
cms-worker_1      |     template = Engine.get_default().from_string(source)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/engine.py", line 136, in from_string
cms-worker_1      |     return Template(template_code, engine=self)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 156, in __init__
cms-worker_1      |     self.nodelist = self.compile_nodelist()
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 194, in compile_nodelist
cms-worker_1      |     return parser.parse()
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 478, in parse
cms-worker_1      |     raise self.error(token, e)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 476, in parse
cms-worker_1      |     compiled_result = compile_func(self, token)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/loader_tags.py", line 266, in do_extends
cms-worker_1      |     nodelist = parser.parse()
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 478, in parse
cms-worker_1      |     raise self.error(token, e)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/base.py", line 476, in parse
cms-worker_1      |     compiled_result = compile_func(self, token)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/defaulttags.py", line 1078, in load
cms-worker_1      |     lib = find_library(parser, name)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/django/template/defaulttags.py", line 1025, in find_library
cms-worker_1      |     name, "\n".join(sorted(parser.libraries)),
cms-worker_1      | django.template.exceptions.TemplateSyntaxError: 'django_markup' is not a registered tag library. Must be one of:
cms-worker_1      | ace
cms-worker_1      | admin_list
cms-worker_1      | admin_modify
cms-worker_1      | admin_static
cms-worker_1      | admin_urls
cms-worker_1      | cache
cms-worker_1      | configuration
cms-worker_1      | enterprise
cms-worker_1      | getattributes
cms-worker_1      | humanize
cms-worker_1      | i18n
cms-worker_1      | l10n
cms-worker_1      | log
cms-worker_1      | method_override
cms-worker_1      | mptt_admin
cms-worker_1      | mptt_tags
cms-worker_1      | oa_extras
cms-worker_1      | optional_include
cms-worker_1      | pipeline
cms-worker_1      | require
cms-worker_1      | rules
cms-worker_1      | sekizai_tags
cms-worker_1      | simple_history_admin_list
cms-worker_1      | simple_history_compat
cms-worker_1      | static
cms-worker_1      | staticfiles
cms-worker_1      | statici18n
cms-worker_1      | theme_pipeline
cms-worker_1      | tz
cms-worker_1      | waffle_tags
cms-worker_1      | webpack_loader
cms-worker_1      | wiki_tags
cms-worker_1      | [2020-06-22 06:30:00,099: ERROR/MainProcess] Task student.tasks.send_activation_email[2a0d56f9-73e5-433b-9d6f-0f5366316184] raised unexpected: Exception()
cms-worker_1      | Traceback (most recent call last):
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/celery/app/trace.py", line 240, in trace_task
cms-worker_1      |     R = retval = fun(*args, **kwargs)
cms-worker_1      |   File "/openedx/venv/lib/python3.5/site-packages/celery/app/trace.py", line 438, in __protected_call__
cms-worker_1      |     return self.run(*args, **kwargs)
cms-worker_1      |   File "/openedx/edx-platform/common/djangoapps/student/tasks.py", line 67, in send_activation_email
cms-worker_1      |     raise Exception
cms-worker_1      | Exception

We can see that the task is forwarded to the CMS worker instead of the LMS worker. This is probably what is causing the missing template error, and as a consequence the missing email. I’ll investigate.

This was actually a pretty serious issues that caused many asynchronous tasks to fail. If you’re interested in the technical details, please checkout this commit message: https://github.com/overhangio/tutor/commit/40a76330f6f238e5fd46f6b3bd37952f5ed35d91

This fix is included in v10.0.6, which will be released in a few minutes. Please upgrade and tell me if it fixes your problem.

Hello, thank you for your prompt answer!

I tried to upgrade to version 10.0.6 by downloading the new binaries and using “tutor local quickstart”, but the following error occurred:

  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 239, in query
_mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1062, "Duplicate entry 'android' for key 'client_id'")
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth credentials for Android application
./manage.py lms create_dot_application \
--client-id android \
--client-secret 2H7BHqEagqLQUtJwHn1j8U02 \
--grant-type password \
android \
login_service_user

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
echo "Migrating LMS uploaded files to shared directory"
mv /openedx/data/uploads/* /openedx/media/
rm -rf /openedx/data/uploads/
  fi
fi

I don’t know why there is this “Duplicate entry ‘android’ for key ‘client_id’”, because I have never configured anything for android.

Should I drop everything and test a clean installation?

Hi
I have an identical problem. ( I had a difficulty upgrading Minio so, I disabled, uninstalled it and moved forward with

Tutor local quickstart.

When upgrading, Tutor shows this error and stops

File "/openedx/venv/lib/python3.5/site-packages/storages/utils.py", line 88, in check_location
    correct,
django.core.exceptions.ImproperlyConfigured: S3BotoStorage.location cannot begin with a leading slash. Found '/openedx/media/'. Use 'openedx/media/' instead.
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth credentials for Android application
./manage.py lms create_dot_application \
    --client-id android \
    --client-secret FrWgM4roEtYKZATJkc82UBbJ \
    --grant-type password \
    --public \
    android \
    login_service_user

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

I just tried to upgrade to version 10.0.7, and the same duplicate key problem in MySQL occurred again:

Loading settings lms.envs.tutor.production
Operations to perform:
  Apply all migrations: admin, announcements, api_admin, assessment, auth, badges, block_structure, bookmarks, branding, bulk_email, bulk_grades, calendar_sync, catalog, celery_utils, certificates, commerce, completion, consent, content_libraries, content_type_gating, contentserver, contenttypes, cornerstone, cors_csrf, course_action_state, course_date_signals, course_duration_limits, course_goals, course_groups, course_modes, course_overviews, courseware, crawlers, credentials, credit, dark_lang, database_fixups, degreed, discounts, django_comment_common, django_notify, djcelery, edx_proctoring, edx_when, edxval, email_marketing, embargo, enterprise, entitlements, experiments, external_user_ids, grades, instructor_task, integrated_channel, lms_xblock, milestones, mobile_api, oauth2_provider, oauth_dispatch, organizations, program_enrollments, programs, redirects, rss_proxy, sap_success_factors, schedules, self_paced, sessions, shoppingcart, site_configuration, sites, social_django, splash, static_replace, status, student, submissions, super_csv, survey, system_wide_roles, teams, theming, third_party_auth, thumbnail, track, user_api, user_authn, util, verified_track_content, verify_student, video_config, video_pipeline, waffle, waffle_utils, wiki, workflow, xapi, xblock_django
Running migrations:
  No migrations to apply.
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry 'android' for key 'client_id'")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 123, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/openedx/edx-platform/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py", line 168, in handle
    application = self._create_application(user, app_name, application_kwargs)
  File "/openedx/edx-platform/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py", line 80, in _create_application
    user=user, name=app_name, **application_kwargs
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/query.py", line 422, in create
    obj.save(force_insert=True, using=self.db)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 741, in save
    force_update=force_update, update_fields=update_fields)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 779, in save_base
    force_update, using, update_fields,
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 870, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 908, in _do_insert
    using=using, raw=raw)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/query.py", line 1186, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1375, in execute_sql
    cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1062, "Duplicate entry 'android' for key 'client_id'")
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

./manage.py lms migrate

# Create oauth credentials for Android application
./manage.py lms create_dot_application \
    --client-id android \
    --client-secret 2H7BHqEagqLQUtJwHn1j8U02 \
    --grant-type password \
    --public \
    android \
    login_service_user

# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
  if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
    echo "Migrating LMS uploaded files to shared directory"
    mv /openedx/data/uploads/* /openedx/media/
    rm -rf /openedx/data/uploads/
  fi
fi

Is there any workaround to this upgrade problem?

Thank you for your message. I’ll try this.

Hi,

I am not sure I gave a solution in my response. I just highlighted that this is a known issue

Thanks

Hi!
I removed the old Tutor version and did a fresh install of version 10.0.7.

Now everything is working and emails (activation and password reset) are being sent correctly.

Thank you both (@regis and @nachham)!

Abrantes

Good for you.

I removed and reinstalled Tutor 10.0.7.
I am afraid it generates the same error!

I don’t know what i am missing here!
Thanks

I was unavailable all day today. This looks like a Tutor bug. I’ll fix it and make a new release (v10.0.8).