diff options
author | zsloan | 2020-08-27 15:15:05 -0500 |
---|---|---|
committer | zsloan | 2020-08-27 15:15:05 -0500 |
commit | dbc07d3f16b7c5337747af40a4d24c2ef27d2145 (patch) | |
tree | 66c58c28a479628342f6a27ebef693b250e452da | |
parent | 0b16990d169718d2aab6139c36655e042fb0f234 (diff) | |
download | genenetwork2-dbc07d3f16b7c5337747af40a4d24c2ef27d2145.tar.gz |
Added logic that creates a user account if an e-mail is added to a group
that isn't already associated with a GN2 account and sends the user an
e-mail; still need to test
* wqflask/wqflask/group_manager.py - Added logic sending an invitation
e-mail if user_details aren't found for any of the e-mails provided when
adding users to a group
-rw-r--r-- | wqflask/wqflask/group_manager.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/wqflask/wqflask/group_manager.py b/wqflask/wqflask/group_manager.py index 24848ed8..99d5db26 100644 --- a/wqflask/wqflask/group_manager.py +++ b/wqflask/wqflask/group_manager.py @@ -1,13 +1,15 @@ from __future__ import print_function, division, absolute_import +import random, string + from flask import (Flask, g, render_template, url_for, request, make_response, redirect, flash) from wqflask import app -from wqflask.user_login import send_verification_email +from wqflask.user_login import send_verification_email, send_invitation_email, basic_info, set_password -from utility.redis_tools import get_user_groups, get_group_info, create_group, delete_group, add_users_to_group, remove_users_from_group, \ +from utility.redis_tools import get_user_groups, get_group_info, save_user, create_group, delete_group, add_users_to_group, remove_users_from_group, \ change_group_name, save_verification_code, check_verification_code, get_user_by_unique_column, get_resources, get_resource_info from utility.logger import getLogger @@ -141,5 +143,16 @@ def send_group_invites(group_id, user_email_list = [], user_type="members"): continue else: send_verification_email(user_details, template_name = "email/group_verification.txt", key_prefix = "verification_code", subject = "You've been invited to join a GeneNetwork user group") + else: + temp_password = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(6)) + user_details = { + 'user_id': str(uuid.uuid4()), + 'email_address': user_email, + 'registration_info': basic_info(), + 'password': set_password(temp_password), + 'confirmed': 0 + } + save_user(user_details, user_details['user_id']) + send_invitation_email(user_email, temp_password) #@app.route()
\ No newline at end of file |