superset icon indicating copy to clipboard operation
superset copied to clipboard

Error while registering a user from the panoramix UI

Open rohitkochar opened this issue 11 years ago • 7 comments

I am trying to register a new user from the panoramix UI by clicking on the register button on the Login Menu but i am getting the following error:

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 "/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_appbuilder/views.py", line 107, in this_form_get
    appbuilder=self.appbuilder
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/baseviews.py", line 156, in render_template
    return render_template(template, dict(list(kwargs.items()) + list(self.extra_args.items())))
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 128, in render_template
    context, ctx.app)
  File "/usr/local/lib/python2.7/dist-packages/flask/templating.py", line 110, in _render
    rv = template.render(context)
  File "/usr/share/pyshared/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 2, in top-level template code
    {% import 'appbuilder/general/lib.html' as lib %}
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/base.html", line 1, in top-level template code
    {% extends base_template %}
  File "/home/sandeeps/panoramix/app/templates/panoramix/base.html", line 1, in top-level template code
    {% extends "appbuilder/baselayout.html" %}
  File "/home/sandeeps/panoramix/app/templates/appbuilder/baselayout.html", line 2, in top-level template code
    {% import 'appbuilder/baselib.html' as baselib %}
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/init.html", line 46, in top-level template code
    {% block body %}
  File "/home/sandeeps/panoramix/app/templates/appbuilder/baselayout.html", line 19, in block "body"
    {% block content %}
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 23, in block "content"
    {% block edit_form %}
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/general/model/edit.html", line 25, in block "edit_form"
    {{ widgets.get('edit')(form_action=form_action)|safe }}
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/widgets.py", line 34, in __call__
    return template.render(args)
  File "/usr/share/pyshared/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/general/widgets/form.html", line 40, in top-level template code
    <tr>{{ lib.render_field(field, begin_sep_label, end_sep_label, begin_sep_field, end_sep_field) }}</tr>
  File "/usr/local/lib/python2.7/dist-packages/flask_appbuilder/templates/appbuilder/general/lib.html", line 203, in template
    {{ field(**kwargs)|safe }}
  File "/usr/local/lib/python2.7/dist-packages/wtforms/fields/core.py", line 149, in __call__
    return self.meta.render_field(self, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/wtforms/meta.py", line 53, in render_field
    return field.widget(field, **render_kw)
  File "/usr/local/lib/python2.7/dist-packages/flask_wtf/recaptcha/widgets.py", line 40, in __call__
    raise RuntimeError("RECAPTCHA_PUBLIC_KEY config not set")
**RuntimeError: RECAPTCHA_PUBLIC_KEY config not set

I have checked out the latest code from the github and followed the steps mentioned in ReadMe file for server installation.

**Is it possible to disable authentication and also configure the druid endpoint in the config file instead of creating a admin role and than adding details there?

rohitkochar avatar Aug 31 '15 06:08 rohitkochar

Here is my config.py file:

import os
from flask_appbuilder.security.manager import AUTH_OID, AUTH_REMOTE_USER, AUTH_DB, AUTH_LDAP, AUTH_OAUTH
basedir = os.path.abspath(os.path.dirname(__file__))

"""
All configuration in this file can be overridden by providing a local_config
in your PYTHONPATH.

There' a ``from local_config import *`` at the end of this file.
"""

ROW_LIMIT = 5000
WEBSERVER_THREADS = 8

PANORAMIX_WEBSERVER_PORT = 8088

SECRET_KEY = '\2\1thisismyscretkey\1\2\e\y\y\h'


SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')

CSRF_ENABLED = True

#Whether to run the web server in debug mode or not
DEBUG = True

APP_NAME = "Panoramix"

APP_ICON = "/static/chaudron_white.png"

AUTH_TYPE = AUTH_DB

AUTH_ROLE_ADMIN = 'Admin'
AUTH_ROLE_PUBLIC = 'Public'

AUTH_USER_REGISTRATION = True

AUTH_USER_REGISTRATION_ROLE = "Admin"

BABEL_DEFAULT_LOCALE = 'en'
BABEL_DEFAULT_FOLDER = 'translations'

LANGUAGES = {
    'en': {'flag':'us', 'name':'English'},
    'fr': {'flag':'fr', 'name':'French'},
}
"""
'pt': {'flag':'pt', 'name':'Portuguese'},
'pt_BR': {'flag':'br', 'name': 'Pt Brazil'},
'es': {'flag':'es', 'name':'Spanish'},
'de': {'flag':'de', 'name':'German'},
'zh': {'flag':'cn', 'name':'Chinese'},
'ru': {'flag':'ru', 'name':'Russian'}
"""
UPLOAD_FOLDER = basedir + '/app/static/uploads/'

IMG_UPLOAD_FOLDER = basedir + '/app/static/uploads/'

IMG_UPLOAD_URL = '/static/uploads/'

try:
    from local_config import *
except:
    pass

rohitkochar avatar Aug 31 '15 06:08 rohitkochar

I tried to recreate your issue by upgrading to the latest version of Flask App Admin and wasn't able to.

Panoramix uses "Flask App Builder" for everything around authentication / permissions. Dropping in a "local_config.py" allows you to override the default config.py configuration. Please refer to the Flask App Builder docs for more info. http://flask-appbuilder.readthedocs.org/en/latest/user_registration.html

mistercrunch avatar Aug 31 '15 15:08 mistercrunch

Thanks for your help,the documentation really helped. My setup was missing the RECAPTCHA keys,generated and added them. Also created the admin user via the "fabmanager" command.

rohitkochar avatar Aug 31 '15 18:08 rohitkochar

I'm not sure why I haven't hit the RECAPTCHA bug on my side... How are you creating the users?

mistercrunch avatar Aug 31 '15 20:08 mistercrunch

I was trying to register user via the UI i.e by clicking on the Login tab on the right most corner and than clicking Register button. After clicking the 'Register' the screen that pop ups for recording user credentials also have a RECAPTCHA verification and hence it need those RECAPTCHA keys.

My authentication type is AUTH_DB and i have default role for self registeration set to "Admin" i.e AUTH_USER_REGISTRATION_ROLE = "Admin"

rohitkochar avatar Sep 01 '15 04:09 rohitkochar

Oh interesting. With the vanilla settings I've been using the Menu -> Security -> List Users and then clicking the + button to create users. I'm new to "Flask App Builder" though I'm coming from Django and Flask-Admin and I'm very happy with the design decisions behind "Flask App Builder". It seems like I can build a generic app and let the users define their authentication scheme.

mistercrunch avatar Sep 01 '15 04:09 mistercrunch

This should be fixed in the current version

mistercrunch avatar Oct 16 '15 06:10 mistercrunch