Users acct with same email

General Discussion

Users acct with same email

Postby usmcguy » Thu Dec 31, 2015 6:56 am

I attempted to create a user account that had the same email address as my user account. It caused an error. I was able to establish based on the traceback, I cant have 2 accounts sharing 1 email address. Not sure if that was intended, but the error wasn't caught. I would think I would just get a notification that I cant use the same email.

Code: Select all
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/opt/alarmdecoder-webapp/ad2web/app.py", line 94, in __call__
    return self.app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/flask_login.py", line 758, in decorated_view
    return func(*args, **kwargs)
  File "/opt/alarmdecoder-webapp/ad2web/decorators.py", line 15, in decorated_function
    return f(*args, **kwargs)
  File "/opt/alarmdecoder-webapp/ad2web/admin/views.py", line 52, in user
    db.session.commit()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/scoping.py", line 150, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 813, in commit
    self.transaction.commit()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 392, in commit
    self._prepare_impl()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
    self.session.flush()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2027, in flush
    self._flush(objects)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2145, in _flush
    transaction.rollback(_capture_exception=True)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py", line 2109, in _flush
    flush_context.execute()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
    rec.execute(self)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
    uow
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 174, in save_obj
    mapper, table, insert)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py", line 800, in _emit_insert_statements
    execute(statement, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
IntegrityError: (sqlite3.IntegrityError) UNIQUE constraint failed: users.email [SQL: u'INSERT INTO users (name, email, openid, activation_key, created_time, avatar, password, role_code, status_code, user_detail_id, followers, following) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'] [parameters: (u'nonuser', u'none@none.com', None, None, '2015-12-31 14:55:23.527099', None, 'pbkdf2:sha1:1000$EwS9qB59$83a4c12c3f5fe982cc3b9cd220a4a6902a408f47', u'1', u'2', None, None, None)]
usmcguy
newt
newt
 
Posts: 12
Joined: Thu Dec 31, 2015 6:11 am

Re: Users acct with same email

Postby kevin » Thu Dec 31, 2015 12:33 pm

This is just something we never anticipated people would do - I will put it on the list to look at

Thank you for the report!
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: Users acct with same email

Postby usmcguy » Sat Jan 02, 2016 5:28 pm

I wanted a separate account so I wasn't always logging in as admin. When I tried to use the same email for both, thats when I realized what happened. Probably not something many people do, but for the few that do, a nice error rather that a dump would be nice.
usmcguy
newt
newt
 
Posts: 12
Joined: Thu Dec 31, 2015 6:11 am

Re: Users acct with same email

Postby TD22057 » Thu Aug 17, 2017 7:18 pm

Actually - I just hit this as well. I think it would be a lot better to just allow the same email address in multiple accounts. I have and admin account with a complicated password and I'd like to make a user account w/ the same email with a much simpler password to use normally. I think that only the user name really needs to be unique.
TD22057
newt
newt
 
Posts: 12
Joined: Tue Aug 15, 2017 9:22 am

Re: Users acct with same email

Postby kevin » Thu Aug 17, 2017 8:12 pm

Yeah this got dropped off the stack - don't know that we'll invest time in changing this as database migration is something we try to avoid if possible. We will fix the exception handling for sure at some point. If using gmail you can try using the + or . trick to use the same address - it will trick the webapp into thinking it's different enough.
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am


Return to General

Who is online

Users browsing this forum: No registered users and 9 guests

cron