[mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-17 Thread gmflanagan
Hi Matt

Here's an app that I put together, roughly copied from a current project:

https://github.com/averagehuman/mezzanine-invites

The idea is that, rather than creating users directly, you create invite 
codes which you give to your colleagues. Then you enable a custom auth 
backend which, when it detects a valid code having been entered, will 
automatically create a new user. It is then up to you to create an 
appropriate registration/login form incorporating a 'key' field. Eg. a form 
with

+ invite code
+ email
+ username
+ password
+ repeat password

In my own use case, I'm printing out invitation codes and handing them to 
(possibly-not-very-computer-literate) people as a quick login/registration 
method, so my login form has a single 'invite_code' field. Also, I am 
allowing this code to be reused as a login token, but in your case if you 
are emailing this token then it ought to be one-shot, so you would have 
to arrange to set 'expired=True' after first use. (Or see the 
INVITE_CODES_ARE_REUSEABLE setting).

YMMV, it's a bit rough, but there it is.

gmflanagan

averagehuman.org






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


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-17 Thread Matt Gushee
Hi, GM--

Thanks, I'll take a look at it.

On Thu, Jul 17, 2014 at 8:05 AM, gmflanagan cyclebelf...@gmail.com wrote:
 Hi Matt

 Here's an app that I put together, roughly copied from a current project:

 https://github.com/averagehuman/mezzanine-invites

 The idea is that, rather than creating users directly, you create invite
 codes which you give to your colleagues. Then you enable a custom auth
 backend which, when it detects a valid code having been entered, will
 automatically create a new user. It is then up to you to create an
 appropriate registration/login form incorporating a 'key' field. Eg. a form
 with

 + invite code
 + email
 + username
 + password
 + repeat password

 In my own use case, I'm printing out invitation codes and handing them to
 (possibly-not-very-computer-literate) people as a quick login/registration
 method, so my login form has a single 'invite_code' field. Also, I am
 allowing this code to be reused as a login token, but in your case if you
 are emailing this token then it ought to be one-shot, so you would have to
 arrange to set 'expired=True' after first use. (Or see the
 INVITE_CODES_ARE_REUSEABLE setting).

 YMMV, it's a bit rough, but there it is.

 gmflanagan

 averagehuman.org






 --
 You received this message because you are subscribed to the Google Groups
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+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 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-17 Thread Matt Gushee
Hi, Josh and all--

Well, I found out that if I set ACCOUNTS_APPROVAL_REQUIRED and
ACCOUNTS_VERIFICATION_REQUIRED to True, as per Stephen's message, I
can then create an inactive user, then go back and set their account
active, and they get a confirmation email. I'm a little confused by
the logic there: if you create and activate an account in separate
steps, a confirmation email is sent, but not if you create an account
that is active from the beginning. Is that intentional, or is it just
a side-effect of the logic for creating public accounts?

Anyway, I'm still looking for a more elegant solution, but this
two-step procedure will work for now.

On Wed, Jul 16, 2014 at 2:30 PM, Josh Cartmell joshcar...@gmail.com wrote:
 Hey Matt, an alternative idea would be to connect to the post save signal
 for User,
 https://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save.

 If the user was created perform a password reset on them.  Here's the code
 in Mezzanine that does resets,
 https://bitbucket.org/stephenmcd/mezzanine/src/05319e2db0712eced56bfd7551fc6078119cbbc8/mezzanine/accounts/views.py?at=default#cl-137.
 Then the password reset email would allow them to choose a new password
 and login.

Okay ... I found the above documentation and code, and I sort of
understand ... I think I don't yet have a good grasp of how the
different parts of Django fit together, but anyway, if I do something
like this, what would be the best place to put the code? It doesn't
seem like something that should be an app ... or is it?

--
Matt Gushee

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


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-17 Thread Ken Bolton
On Thu, Jul 17, 2014 at 7:58 PM, Matt Gushee m...@gushee.net wrote:

 Hi, Josh and all--

 Well, I found out that if I set ACCOUNTS_APPROVAL_REQUIRED and
 ACCOUNTS_VERIFICATION_REQUIRED to True, as per Stephen's message, I
 can then create an inactive user, then go back and set their account
 active, and they get a confirmation email. I'm a little confused by
 the logic there: if you create and activate an account in separate
 steps, a confirmation email is sent, but not if you create an account
 that is active from the beginning. Is that intentional, or is it just
 a side-effect of the logic for creating public accounts?


The flow, as I understand it, is unauthed user registers an account. Admin
approves the account, which triggers the email notification. Otherwise, the
unauthed user would never know that their account had been approved.

Anyway, I'm still looking for a more elegant solution, but this
 two-step procedure will work for now.


It seems to me you are searching for a problem, not a solution.


 Okay ... I found the above documentation and code, and I sort of
 understand ... I think I don't yet have a good grasp of how the
 different parts of Django fit together, but anyway, if I do something
 like this, what would be the best place to put the code? It doesn't
 seem like something that should be an app ... or is it?


Make it an app in your project. Anything else will be much more work for
you in the long run. Django applications can have tests, models, views,
urls, forms, management commands, tasks, etc. or any subset of these,
though tests are often required. With an app, you can customize every
aspect of your Mezzanine(Django(Python)) project. Remember that Mezzanine
is just an Django app.

You currently have a project. The Django way is to make apps in the root of
your project, though some groups like to create an apps directory. 6 ==
0.5*12. Perhaps call your app registration. Take advantage of the Django
startapp management command, documented at
https://docs.djangoproject.com/en/dev/ref/django-admin/#startapp-app-label-destination
.

It is always difficult in an email to know exactly which path through the
documentation the writer has taken. If you have not yet completed the the
official Django Tutorial, I urge you to. Ross Laird also wrote a bunch of
excellent blog posts that cover getting started with Mezzanine.

ken

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


[mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Eduardo Rivas
Hi Matt. Mezzanine supports user access control in a self-service 
configuration that might be useful for you. You can have your users request 
an account (fill in their details and password), but they will not be 
granted access to the site (they can't log in) until an authorized member 
clears their request. You can define a list of email addresses that will be 
notified when new users request accounts. This way you don't have to 
manually enter every user's details, but you still have complete control 
over all of them. If you grant permission to a user, he/she will get an 
email notification to let them now they can use the site (complete with a 
log in link).

This requires you set ACCOUNTS_APPROVAL_REQUIRED = True in settings.py. 
Then you have to configure the emails that will be notified on new account 
requests in the Settings section of the Admin interface. The setting is 
called Account approval email addresses under the Miscellaneous section.

To approve a new user, simply login to the Admin site (you need to have 
permission to change User objects), look for the user in question (you'll 
receive a direct link with the notification email), and check the Active 
box, then Save. This will notify the new user and let them log in to your 
site.

I've been using this method for an online store I'm working in where only 
registered users can order products, and we want to screen them all. Hope 
that helps.

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


[mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Eduardo Rivas
Also, my explanation is really just a rephrasing of what you can find in 
the official docs: 
http://mezzanine.jupo.org/docs/user-accounts.html#account-approval. In that 
page you'll also find info about the more traditional Click here to verify 
your account approach, and details on Mezzanine's implementation of user 
accounts, which is pretty flexible and capable out of the box.

Lastly, remember you must have your email settings set correctly to be able 
to send notifications to your users and yourself. For example, you can use 
a Gmail account:
EMAIL_HOST_USER = 'exam...@gmail.com'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_PASSWORD = 'GmailPassword'
EMAIL_PORT = 587
SERVER_EMAIL = EMAIL_HOST_USER

These go into settings.py and you only need to change your gmail address 
and password. Of course, other SMTP servers will work fine with their own 
settings.

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


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Matt Gushee
Hi again--

On Wed, Jul 16, 2014 at 1:47 PM, Eduardo Rivas jerivasmel...@gmail.com wrote:

 Lastly, remember you must have your email settings set correctly to be able
 to send notifications to your users and yourself. For example, you can use a
 Gmail account:
 EMAIL_HOST_USER = 'exam...@gmail.com'

... etc.

Good to know. I probably would have found the email settings on my
own, but I wasn't aware of them yet, so thank you.

--
Matt Gushee

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


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Matt Gushee
Hi, Josh--

Awesome! That sounds like what I'm looking for. I don't fully
understand your suggestion, but I should be able to figure it out. If
not, I'll be back with more questions ... because I need this to work
;-)

BTW, any opinion on my question as to whether this should be a core
feature? I never expected I would say anything nice about a certain
other well-known CMS ... but Drupal does this out of the box, and it
seems pretty basic and desirable to me. Don't get me wrong: overall I
found Drupal to be a nightmare, and though Mezzanine/Django is posing
some unexpected challenges, so far the experience is anything but
nightmarish, so I'm not going back. However, this is one thing that
Drupal does right. IMHO.

Thanks,
Matt

On Wed, Jul 16, 2014 at 2:30 PM, Josh Cartmell joshcar...@gmail.com wrote:
 Hey Matt, an alternative idea would be to connect to the post save signal
 for User,
 https://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save.

 If the user was created perform a password reset on them.  Here's the code
 in Mezzanine that does resets,
 https://bitbucket.org/stephenmcd/mezzanine/src/05319e2db0712eced56bfd7551fc6078119cbbc8/mezzanine/accounts/views.py?at=default#cl-137.
 Then the password reset email would allow them to choose a new password
 and login.

 In that way you could create a user in the admin interface and they would
 automatically receive an email that gave them access to their account.


 On Wed, Jul 16, 2014 at 4:26 PM, Matt Gushee m...@gushee.net wrote:

 Hi, Eduardo--

 Thanks for your quick reply!

 On Wed, Jul 16, 2014 at 1:27 PM, Eduardo Rivas jerivasmel...@gmail.com
 wrote:
  Hi Matt. Mezzanine supports user access control in a self-service
  configuration that might be useful for you. You can have your users
  request
  an account (fill in their details and password), but they will not be
  granted access to the site (they can't log in) until an authorized
  member
  clears their request.

 Yes, I saw that, but from a user experience perspective I don't find
 it satisfactory. For my users, having an account on my site is a just
 a means to an end, so it had better be as convenient as possible.
 *Telling* people to go to my site and do something that *I* want them
 to do, for reasons that may be unclear or unimportant to them, feels
 like a very 20th-century way of interacting online.

 Sounds like I might need to write some code. Which I don't really
 mind, but was hoping to avoid doing at this early stage. So I have a
 question: is this (email confirmations for admin-created accounts) a
 feature that should go into Mezzanine core? Or shall I plan on just
 extending the account management code for my own purposes?

 --
 Matt Gushee

 --
 You received this message because you are subscribed to the Google Groups
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+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
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+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 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Josh Cartmell
Definitely ask away if you have more questions!

Mezzanine tries to implement a basic set of features and make it easy to
add on when it's desirable.  With that in mind I think whether or not it
should be a core feature comes down to the demand and weather or not
someone has time to code it =)


On Wed, Jul 16, 2014 at 4:42 PM, Matt Gushee m...@gushee.net wrote:

 Hi, Josh--

 Awesome! That sounds like what I'm looking for. I don't fully
 understand your suggestion, but I should be able to figure it out. If
 not, I'll be back with more questions ... because I need this to work
 ;-)

 BTW, any opinion on my question as to whether this should be a core
 feature? I never expected I would say anything nice about a certain
 other well-known CMS ... but Drupal does this out of the box, and it
 seems pretty basic and desirable to me. Don't get me wrong: overall I
 found Drupal to be a nightmare, and though Mezzanine/Django is posing
 some unexpected challenges, so far the experience is anything but
 nightmarish, so I'm not going back. However, this is one thing that
 Drupal does right. IMHO.

 Thanks,
 Matt

 On Wed, Jul 16, 2014 at 2:30 PM, Josh Cartmell joshcar...@gmail.com
 wrote:
  Hey Matt, an alternative idea would be to connect to the post save signal
  for User,
 
 https://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save
 .
 
  If the user was created perform a password reset on them.  Here's the
 code
  in Mezzanine that does resets,
 
 https://bitbucket.org/stephenmcd/mezzanine/src/05319e2db0712eced56bfd7551fc6078119cbbc8/mezzanine/accounts/views.py?at=default#cl-137
 .
  Then the password reset email would allow them to choose a new password
  and login.
 
  In that way you could create a user in the admin interface and they would
  automatically receive an email that gave them access to their account.
 
 
  On Wed, Jul 16, 2014 at 4:26 PM, Matt Gushee m...@gushee.net wrote:
 
  Hi, Eduardo--
 
  Thanks for your quick reply!
 
  On Wed, Jul 16, 2014 at 1:27 PM, Eduardo Rivas jerivasmel...@gmail.com
 
  wrote:
   Hi Matt. Mezzanine supports user access control in a self-service
   configuration that might be useful for you. You can have your users
   request
   an account (fill in their details and password), but they will not be
   granted access to the site (they can't log in) until an authorized
   member
   clears their request.
 
  Yes, I saw that, but from a user experience perspective I don't find
  it satisfactory. For my users, having an account on my site is a just
  a means to an end, so it had better be as convenient as possible.
  *Telling* people to go to my site and do something that *I* want them
  to do, for reasons that may be unclear or unimportant to them, feels
  like a very 20th-century way of interacting online.
 
  Sounds like I might need to write some code. Which I don't really
  mind, but was hoping to avoid doing at this early stage. So I have a
  question: is this (email confirmations for admin-created accounts) a
  feature that should go into Mezzanine core? Or shall I plan on just
  extending the account management code for my own purposes?
 
  --
  Matt Gushee
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Mezzanine Users group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to mezzanine-users+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
  Mezzanine Users group.
  To unsubscribe from this group and stop receiving emails from it, send an
  email to mezzanine-users+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
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+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 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [mezzanine-users] Re: Email confirmation for admin-created users?

2014-07-16 Thread Stephen McDonald
For the record, it's mostly already implemented when you combine both the
approval/verification settings:

https://github.com/stephenmcd/mezzanine/blob/master/mezzanine/accounts/admin.py#L22-L45



On Thu, Jul 17, 2014 at 11:03 AM, Josh Cartmell joshcar...@gmail.com
wrote:

 Definitely ask away if you have more questions!

 Mezzanine tries to implement a basic set of features and make it easy to
 add on when it's desirable.  With that in mind I think whether or not it
 should be a core feature comes down to the demand and weather or not
 someone has time to code it =)


 On Wed, Jul 16, 2014 at 4:42 PM, Matt Gushee m...@gushee.net wrote:

 Hi, Josh--

 Awesome! That sounds like what I'm looking for. I don't fully
 understand your suggestion, but I should be able to figure it out. If
 not, I'll be back with more questions ... because I need this to work
 ;-)

 BTW, any opinion on my question as to whether this should be a core
 feature? I never expected I would say anything nice about a certain
 other well-known CMS ... but Drupal does this out of the box, and it
 seems pretty basic and desirable to me. Don't get me wrong: overall I
 found Drupal to be a nightmare, and though Mezzanine/Django is posing
 some unexpected challenges, so far the experience is anything but
 nightmarish, so I'm not going back. However, this is one thing that
 Drupal does right. IMHO.

 Thanks,
 Matt

 On Wed, Jul 16, 2014 at 2:30 PM, Josh Cartmell joshcar...@gmail.com
 wrote:
  Hey Matt, an alternative idea would be to connect to the post save
 signal
  for User,
 
 https://docs.djangoproject.com/en/dev/ref/signals/#django.db.models.signals.post_save
 .
 
  If the user was created perform a password reset on them.  Here's the
 code
  in Mezzanine that does resets,
 
 https://bitbucket.org/stephenmcd/mezzanine/src/05319e2db0712eced56bfd7551fc6078119cbbc8/mezzanine/accounts/views.py?at=default#cl-137
 .
  Then the password reset email would allow them to choose a new
 password
  and login.
 
  In that way you could create a user in the admin interface and they
 would
  automatically receive an email that gave them access to their account.
 
 
  On Wed, Jul 16, 2014 at 4:26 PM, Matt Gushee m...@gushee.net wrote:
 
  Hi, Eduardo--
 
  Thanks for your quick reply!
 
  On Wed, Jul 16, 2014 at 1:27 PM, Eduardo Rivas 
 jerivasmel...@gmail.com
  wrote:
   Hi Matt. Mezzanine supports user access control in a self-service
   configuration that might be useful for you. You can have your users
   request
   an account (fill in their details and password), but they will not be
   granted access to the site (they can't log in) until an authorized
   member
   clears their request.
 
  Yes, I saw that, but from a user experience perspective I don't find
  it satisfactory. For my users, having an account on my site is a just
  a means to an end, so it had better be as convenient as possible.
  *Telling* people to go to my site and do something that *I* want them
  to do, for reasons that may be unclear or unimportant to them, feels
  like a very 20th-century way of interacting online.
 
  Sounds like I might need to write some code. Which I don't really
  mind, but was hoping to avoid doing at this early stage. So I have a
  question: is this (email confirmations for admin-created accounts) a
  feature that should go into Mezzanine core? Or shall I plan on just
  extending the account management code for my own purposes?
 
  --
  Matt Gushee
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Mezzanine Users group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to mezzanine-users+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
  Mezzanine Users group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to mezzanine-users+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
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+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
 Mezzanine Users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to mezzanine-users+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
Mezzanine Users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit