The system will try to send an email to the new user asking them to verify
their email.

The 500 internal server error is not intentional, is a bug you found :-).
Could you open an issue in https://github.com/openwisp/openwisp-users/ please?
You can link this ML discussion in its description.
That would be useful, thanks.

Federico

On Sun, Apr 7, 2019 at 11:05 PM Israel Surio <israel.su...@gmail.com> wrote:

> Hello Federico,
>
> I have installed a fresh installation of Debian 9 server. I have performed
> the following commands on the server after installation.
>
> $ apt-get install net-tools
>> $ apt-get install sudo
>> $ usermod -aG sudo test
>>
> $ reboot
>>
>
> *Back on the laptop, i ran the following command:*
>
> $ cat ~/test-srv/hosts
>> [test-srv]
>> sub.domain.com:PORT
>>
>> $ cat ~/test-srv/playbook.yml
>> - hosts: test-srv
>>   become: "{{ become | default('yes') }}"
>>   roles:
>>     - openwisp.openwisp2
>>   vars:
>>     openwisp2_default_from_email: "perso...@email.com"
>>
>> $ ansible-playbook -i hosts playbook.yml -u test -k --become -K
>>
>
> On latest FireFox browser,
> i connected to sub.domain.com:PORT
> logged in with, admin:admin
> i tried adding a new user,
> received again:
> Server Error (500)
> .....
>
>> $ cd /opt/openwisp2/log
>>
> *error.log:*
>
> [ERROR 2019-04-08 02:31:24,225] module: exception, process: 16025, thread:
> 140192369125120
> Internal Server Error: /admin/openwisp_users/user/add/
> Traceback (most recent call last):
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/handlers/exception.py",
> line 35, in inner
>     response = get_response(request)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/handlers/base.py",
> line 128, in _get_response
>     response = self.process_exception_by_middleware(e, request)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/handlers/base.py",
> line 126, in _get_response
>     response = wrapped_callback(request, *callback_args, **callback_kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/admin/options.py",
> line 575, in wrapper
>     return self.admin_site.admin_view(view)(*args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 142, in _wrapped_view
>     response = view_func(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/views/decorators/cache.py",
> line 44, in _wrapped_view_func
>     response = view_func(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/admin/sites.py",
> line 223, in inner
>     return view(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 62, in _wrapper
>     return bound_func(*args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/views/decorators/debug.py",
> line 76, in sensitive_post_parameters_wrapper
>     return view(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 58, in bound_func
>     return func.__get__(self, type(self))(*args2, **kwargs2)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 62, in _wrapper
>     return bound_func(*args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 142, in _wrapped_view
>     response = view_func(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 58, in bound_func
>     return func.__get__(self, type(self))(*args2, **kwargs2)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/auth/admin.py",
> line 100, in add_view
>     return self._add_view(request, form_url, extra_context)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/auth/admin.py",
> line 127, in _add_view
>     return super().add_view(request, form_url, extra_context)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/reversion/admin.py", line
> 177, in add_view
>     return super(VersionAdmin, self).add_view(request, form_url,
> extra_context)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/admin/options.py",
> line 1554, in add_view
>     return self.changeform_view(request, None, form_url, extra_context)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 62, in _wrapper
>     return bound_func(*args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 142, in _wrapped_view
>     response = view_func(request, *args, **kwargs)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/utils/decorators.py",
> line 58, in bound_func
>     return func.__get__(self, type(self))(*args2, **kwargs2)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/admin/options.py",
> line 1451, in changeform_view
>     return self._changeform_view(request, object_id, form_url,
> extra_context)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/contrib/admin/options.py",
> line 1491, in _changeform_view
>     self.save_model(request, new_object, form, not add)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/openwisp_users/admin.py",
> line 115, in save_model
>     signup=True)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/allauth/account/managers.py",
> line 19, in add_email
>     email_address.send_confirmation(request, signup=signup)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/allauth/account/models.py",
> line 60, in send_confirmation
>     confirmation.send(request, signup=signup)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/allauth/account/models.py",
> line 166, in send
>     get_adapter(request).send_confirmation_mail(request, self, signup)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/allauth/account/adapter.py",
> line 444, in send_confirmation_mail
>     ctx)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/allauth/account/adapter.py",
> line 137, in send_mail
>     msg.send()
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/mail/message.py",
> line 294, in send
>     return self.get_connection(fail_silently).send_messages([self])
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/mail/backends/smtp.py",
> line 110, in send_messages
>     sent = self._send(message)
>   File
> "/opt/openwisp2/env/lib/python3.5/site-packages/django/core/mail/backends/smtp.py",
> line 126, in _send
>     self.connection.sendmail(from_email, recipients,
> message.as_bytes(linesep='\r\n'))
>   File "/usr/lib/python3.5/smtplib.py", line 876, in sendmail
>     raise SMTPRecipientsRefused(senderrs)
> smtplib.SMTPRecipientsRefused: {'priv...@email.com': (550, b'5.1.1 <
> priv...@email.com>: Recipient address rejected: User unknown in local
> recipient table')}
>
> *runworker.log:*
>
> :0: UserWarning: You do not have a working installation of the
> service_identity module: 'cannot import name 'opentype''.  Please install
> it from <https://pypi.python.org/pypi/service_identity> and make sure all
> of its dependencies are satisfied.  Without the service_identity module,
> Twisted can perform only rudimentary TLS client hostname verification.
> Many valid certificate/hostname mappings may be rejected.
> 2019-04-08 02:23:32,454 - INFO - runworker - Using single-threaded worker.
> 2019-04-08 02:23:32,455 - INFO - runworker - Running worker against
> channel layer default (asgi_redis.core.RedisChannelLayer)
> 2019-04-08 02:23:32,456 - INFO - worker - Listening on channels
> http.request, websocket.connect, websocket.disconnect, websocket.receive
>
> .....
>
> What I have found! (workaround) (solution?)
> Adding a new user with a `fake email` will output a `Server error (500)`
> message. Adding the new user again with a `real email` will work and the
> system will add the new user accordingly. From this point, the new user can
> now be edited with a `fake email` and the `real email` can now be removed
> from the database.
>
> Is this the real intention of the system?
> I have performed several re-installation of Debian 9 and OpenWISP2 server
> because I didn't knew I was able to just add a new user with a `real email`
> and from there edit the new user with a `fake email`. Waste of time to be
> honest...
>
> Regards
>
>
>
> On Wed, 3 Apr 2019 at 22:47, Federico Capoano <federico.capo...@gmail.com>
> wrote:
>
>> Hi Isreal,
>>
>> if you could please check the log to find the error and share it here it
>> would be helpful, there may be a bug.
>>
>> Then try using instructions like the following to set the SMTP server on
>> django to use an external one, which is always the best option:
>>
>> EMAIL_USE_TLS = True
>> EMAIL_HOST = 'smtp.you-rdomain.com'
>> EMAIL_HOST_USER = 'usern...@your-domain.com'
>> EMAIL_HOST_PASSWORD = 'password'
>> EMAIL_PORT = 25 # or 587
>>
>> Beware that if the config is not correct, email sending will fail.
>>
>> You can set those config options also in the playbook y using the
>> variable openwisp2_extra_django_settings as indicated in the README of
>> ansible-openwisp2
>> <https://github.com/openwisp/ansible-openwisp2#role-variables>.
>>
>> I hope it helps.
>>
>> Best
>> Federico
>>
>> On Wed, Apr 3, 2019 at 10:17 PM ICore <israel.su...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> As the title suggest, the server keeps showing a gateway error 500 when
>>> I try to add a new user within the admin panel.
>>>
>>> I have followed the documention and even tried changing database servers
>>> to mysql to no avail.
>>>
>>> I have a domain name but i am using a subdomain for the openwisp2 server
>>> instance. Right now, LetsEncrypt also fails.
>>>
>>> Followed tutorial from:
>>> https://github.com/openwisp/ansible-openwisp2#usage-tutorial
>>>
>>> Openwisp-config is working on all the routers i have added for testing
>>> purposes. I do not want to deploy template because I need to fix the adding
>>> new users issue first.
>>>
>>> Thank you.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "OpenWISP" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to openwisp+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "OpenWISP" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to openwisp+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "OpenWISP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to openwisp+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to openwisp+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to