[ckan-dev] Log in option removal

Neuvonen Samuli samuli.neuvonen at ymparisto.fi
Wed Apr 3 06:00:12 UTC 2019


Hello Judith,

Good to hear you got it working. As I hinted, I think it might be a good idea to use your own theme to make these changes, instead of making the changes directly to the "CKAN core" templates. As far as I understand, this can be problematic if at some point you want to update CKAN. Then you might have  to make these changes again. Once again, someone more experienced can correct me if I'm wrong.

Regards,
Sam


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Judith Moran
Sent: 3. huhtikuuta 2019 8:52
To: CKAN Development Discussions
Subject: Re: [ckan-dev] Log in option removal

Hi Samuli,

Thanks for the response. It made me think I was on the right track.

I commented out the whole block and tested. All ok.

Then I commented out the user.login and user.register lines (like you did just for log in).

Either way it worked for me.

The used the URL you provided and could still log in.



    <nav class="account not-authed">
      <ul class="list-unstyled">
        {% block header_account_notlogged %}
        <li>{% link_for _('Log in'), named_route='user.login' %}</li>
        {% if h.check_access('user_create') %}
        <li>{% link_for _('Register'), named_route='user.register', class_='sub' %}</li>
        {% endif %} {% endblock %}
      </ul>
    </nav>

Then I turned  ckan.auth.create_user_via_web = true, as without it I could not create a new user from the portal when logged in as Admin.


Thanks for your assistance.


Judy


From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Neuvonen Samuli
Sent: Wednesday, 3 April 2019 2:01 PM
To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
Subject: Re: [ckan-dev] Log in option removal

Hello Judith,

We have created our own theme (https://docs.ckan.org/en/2.8/theming/index.html) and there we have removed the login in templates/header.html just as you expected, by commenting out the line

<!-- <li>{% link_for _('Log in'), controller='user', action='login' %}</li> -->

All our registered users, including admins, login by going directly to login-page's URL i.e.

https://demo.ckan.org/user/login

Regards,
Samuli



From: ckan-dev [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Judith Moran
Sent: 3. huhtikuuta 2019 6:39
To: CKAN Development Discussions
Subject: Re: [ckan-dev] Log in option removal

Oops took a sentence out which was in the incorrect place

Hi,

My Manager wants to hide the Log in option  and Register Option on each page in the CKAN header.

I found this in the code below in the  header.html, moved to our theme directory and removed ('Log in') so have ('').

When I move around to different pages an error appears where the Log in would have been.

Would it be better just to comment out the complete Nav section, but then how does the administrator log in if this option is removed??


    <nav class="account not-authed">
      <ul class="list-unstyled">
        {% block header_account_notlogged %}
        <li>{% link_for _('Log in'), named_route='user.login' %}</li>
        {% if h.check_access('user_create') %}
        <li>{% link_for _('Register'), named_route='user.register', class_='sub' %}</li>
        {% endif %} {% endblock %}
      </ul>
    </nav>


I updated production.ini parameter to false to remove the Registration option.

ckan.auth.create_user_via_web = false

Can anyone assist with removing the log in option but still allowing Adminstrators to log in.



Regards,



Judy Moran
Manager Data Strategy
Department of Corporate and Information Services
Northern Territory Government of Australia
T:  892 96550
E:  DataStrategy.NTG at nt.gov.au<mailto:DataStrategy.NTG at nt.gov.au>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20190403/3f3ab9ea/attachment-0002.html>


More information about the ckan-dev mailing list