Ticket #1413 (closed enhancement: fixed)

Opened 3 years ago

Last modified 2 years ago

Ask users to 'add email address' when logged in

Reported by: shevski Owned by: seanh
Priority: awaiting triage Milestone: ckan-backlog
Component: ckan Keywords:
Cc: Repository: ckan
Theme: notifications

Description (last modified by dread) (diff)

I'd like us to display a one-off banner that prompts users who log into thedatahub.org to go and update & their profile & fill in their email address (if we could do it just for those who don't have an email address, then even better) That is, once they log in, they see a banner which says: Please update your profile [here] and add your email address, so you can receive notifications, be able to reset your password and get updates

Then when we build notifications or if we decide to survey people, we can actually contact them. Email address should be required as standard

DR: Also, mention their Full Name too - v. useful for selecting correct user in group curation

Change History

comment:1 Changed 3 years ago by dread

  • Owner set to seanh
  • Status changed from new to assigned
  • Description modified (diff)

comment:2 Changed 2 years ago by seanh

I've made a first attempt at this here:

https://github.com/seanh/ckan/compare/feature-1413-ask-users-to-add-email-address

I used flash_notice() to ask the user to add an email whenever they visit their account page, if they don't have one already. This means they'll see the notice when they login, because after login they are redirected to their account page. Issues:

Is it okay to approximate 'once they log in' as 'whenever they visit their account page' like this?

Do I need to do something to support i18n for the string I added? I looked at users of flash_*() elsewhere and they seemed to be hardcoding the strings in English.

comment:3 Changed 2 years ago by dread

approximate 'once they log in' as 'whenever they visit their account page'

I had imagined that this would be done in the user.py:logged_in method, but doing it in your way sounds like an even better plan.

Another thought is: a lot of people might just use the cookie and v. rarely logout/in. Perhaps it could be done when they come back to the site at intervals (e.g. daily)?

i18n

Yes your strings should be internationalised because they are user visible.

You're right that these other strings should be internationalised. I've created a separate ticket for this: #1491

comment:4 Changed 2 years ago by seanh

Another thought is: a lot of people might just use the cookie and v. rarely logout/in. Perhaps it could be done when they come back to the site at intervals (e.g. daily)?

As discussed on IRC I've moved the notice from the user account page to the front page, in the hopes that people will see it often enough even if they are always logged in via a cookie. As discussed on IRC, we could make the notice appear on every page but no more than once per day, but that would be more complicated to implement and more likely to break.

Yes your strings should be internationalised because they are user visible.

Done.

You're right that these other strings should be internationalised. I've created a separate ticket for this: #1491

Also done! :)

comment:5 Changed 2 years ago by seanh

Added a 'please enter your full name' flash notice as well (the two are combined into one if they have neither full name nor email), added unit tests, fixed some issues.

Still need to adjust the strings and change the full name notice so that it applies to people with gmail IDs only.

https://github.com/seanh/ckan/compare/feature-1413-ask-users-to-add-email-address

comment:6 Changed 2 years ago by seanh

Adjusted the 'please add your email' string and changed the 'please add your full name' notice to be used only for Google OpenID users. Finished?

https://github.com/seanh/ckan/commits/feature-1413-ask-users-to-add-email-address

comment:7 Changed 2 years ago by seanh

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:8 Changed 2 years ago by dread

Code reviewed - looks really good. Do merge in to master if it is not already.

A couple of tips:

  • we all use 'model.User' instead of 'model.user.User' but it's not important for tests...
  • probably better to use CreateTestData?.create_user() to create user objects in the future, avoiding faffing around with creating revisions etc. that are also nastier to debug when they go wrong.

comment:9 Changed 2 years ago by dread

Went into CKAN 1.6

Note: See TracTickets for help on using tickets.