dracidoupe / graveyard

Open Source reimplementation of https://www.dracidoupe.cz/
https://nove.dracidoupe.cz/
MIT License
6 stars 4 forks source link

Reset password can fail for migration of user with bad access #458

Closed Almad closed 3 months ago

Almad commented 3 months ago

https://almad.sentry.io/share/issue/3cb0f8328c0744aa8a9d6d663550355a/

OperationalError: (1048, "Column 'pospristup' cannot be null")
  File "django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)

IntegrityError: (1048, "Column 'pospristup' cannot be null")
  File "django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "django/contrib/auth/views.py", line 222, in dispatch
    return super().dispatch(*args, **kwargs)
  File "django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "django/views/generic/edit.py", line 142, in post
    return self.form_valid(form)
  File "django/contrib/auth/views.py", line 235, in form_valid
    form.save(**opts)
  File "django/contrib/auth/forms.py", line 311, in save
    for user in self.get_users(email):
  File "ddcz/forms/authentication.py", line 33, in get_users
    migrate_user(profile=up)
  File "ddcz/users.py", line 22, in migrate_user
    profile.save()
  File "django/db/models/base.py", line 753, in save
    self.save_base(using=using, force_insert=force_insert,
  File "django/db/models/base.py", line 790, in save_base
    updated = self._save_table(
  File "django/db/models/base.py", line 872, in _save_table
    updated = self._do_update(base_qs, using, pk_val, values, update_fields,
  File "django/db/models/base.py", line 926, in _do_update
    return filtered._update(values) > 0
  File "django/db/models/query.py", line 803, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "django/db/models/sql/compiler.py", line 1522, in execute_sql
    cursor = super().execute_sql(result_type)
  File "django/db/models/sql/compiler.py", line 1156, in execute_sql
    cursor.execute(sql, params)
  File "django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/backends/mysql/base.py", line 78, in execute
    raise IntegrityError(*tuple(e.args))