[ckan-dev] Extending CKAN - login_form?

Michael Speth spethm at landcareresearch.co.nz
Thu Feb 9 02:41:05 UTC 2017


Date: Mon, 30 Jan 2017 10:09:58 +0100
From: Matthew Fullerton <matt.fullerton at gmail.com<mailto:matt.fullerton at gmail.com>>
To: CKAN Development Discussions <ckan-dev at lists.okfn.org<mailto:ckan-dev at lists.okfn.org>>
Subject: Re: [ckan-dev] Extending CKAN - login_form?
Message-ID:
        <CAAm+7TaAZO=zAkWAsfi_YvGfVTFpbkDP-NjGx7pPgfKHqrpJFQ at mail.gmail.com<mailto:zAkWAsfi_YvGfVTFpbkDP-NjGx7pPgfKHqrpJFQ at mail.gmail.com>>
Content-Type: text/plain; charset="utf-8"
Its not quite clear to me what you're trying to achieve, but I suspect you
might need/want to specify what controller is involved higher up at the
routing stage, see:
http://docs.ckan.org/en/latest/extensions/plugin-interfaces.html#ckan.plugins.interfaces.IRoutes
Examples:
https://gist.github.com/seanh/2352758
https://github.com/okfde/ckanext-offenedaten/blob/ckan-2.3/ckanext/offenedaten/plugin.py#L87


Thank you for the help but this additional information still doesn't solve my problem.

Hopefully I can clear up what I am trying to do with the picture listed in the link below.

Basically, the login page is replaced with the ldap login page.  That means a new login page must be created to handle non ldap users.  See image below for an understanding.

When the user clicks on 'login' at the top right, it takes them to the 'new' ldap login page. (user/login)

When the user clicks on the 'local login page' URL from the now new login page, it takes them to the 2nd picture (user/ckan_login)

http://imgur.com/a/a5cJs

The user.py class has been extended like this
from ckan.plugins import toolkit
from ckan.controllers.user import UserController
class UserController(toolkit.BaseController):
    def ldap_login(self):
        return toolkit.render('user/login.html')
    def ckan_login(self):
        return toolkit.render('user/login_ckan.html')

Routes:
       map.connect('ldap_login', '/user/ldap_login',
                    controller=user, action='ldap_login')
        map.connect('/user/ckan_login', '/user/ckan_login',
                    controller=user, action='ckan_login')

Snip from login_ckan.py
{% set controller = 'ckan.controllers.user:UserController' %} {% block breadcrumb_content %}
{{ h.nav_link(_('Local Account'), controller=controller, action='login') }}
{% endblock %} {% block primary_content %}
{% block page_heading %}{{ _('Login') }}{% endblock %}
{% block form %} {% snippet "user/snippets/login_form.html", action='c.login_handler', error_summary=error_summary %} {% endblock %}

 Thank you for your help
--
Michael Speth
DevOps Computer Engineer
Landcare Research Consultant

________________________________

Please consider the environment before printing this email
Warning: This electronic message together with any attachments is confidential. If you receive it in error: (i) you must not read, use, disclose, copy or retain it; (ii) please contact the sender immediately by reply email and then delete the emails.
The views expressed in this email may not be those of Landcare Research New Zealand Limited. http://www.landcareresearch.co.nz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20170209/a2e16f3b/attachment-0002.html>


More information about the ckan-dev mailing list