def send_reminders():
    users = store.session.query(User).filter_by(
        active=True, email_confirmed=False).all()
    for user in users:
        template = mail_actions.CONFIRM_EMAIL_REMINDER_TEMPLATE
        subject = 'Please confirm email address.'
        mail_actions.request_signup_email_confirmation(
            user, template=template, subject=subject)
def send_reminders():
    users = store.session.query(User).filter_by(active=True,
                                                email_confirmed=False).all()
    for user in users:
        template = mail_actions.CONFIRM_EMAIL_REMINDER_TEMPLATE
        subject = 'Please confirm email address.'
        mail_actions.request_signup_email_confirmation(user,
                                                       template=template,
                                                       subject=subject)
Пример #3
0
 def usersignup():
     data = request.json
     user = data.get('user', None)
     email = user.get('email', '')
     password = data.get('password', None)
     # Check that the email isn't in use.
     existing_user = store.session.query(User).filter(
         User.email==email, User.active==True).first()
     if existing_user is not None:
         response = base_routes.make_bad_request_response(
             'That email address is already associated with an account.')
     elif password is None:
         response = base_routes.make_bad_request_response(
             'A password was not specified.');
     else:
         user = User.admin_deserialize_add(user)
         error_messages = user.set_password(password)
         if error_messages:
             error_message = ', '.join(error_messages)
             response = base_routes.make_bad_request_response(error_message)
         else:
             store.session.add(user)
             store.session.commit()
             error_message = mail_actions.request_signup_email_confirmation(user)
             secret = user.make_api_key()
             serialized = user.serialize(user)
             response_data = {
                 'data': serialized,
                 'apiKey': secret.key,
                 'warningMessage': 'Failed to send email confirmation: {0}'.format(error_message)
             }
             response = jsonify(response_data)
     return response
Пример #4
0
 def usersignup():
     data = request.json
     user = data.get('user', None)
     email = user.get('email', '')
     password = data.get('password', None)
     # Check that the email isn't in use.
     existing_user = store.session.query(User)
     existing_user = existing_user.filter(User.email == email, User.active == True)
     existing_user = existing_user.first()
     if existing_user is not None:
         raise BadRequest('That email address is already associated with an account.')
     elif password is None:
         raise BadRequest('No password was found. Please include a "password" property in the payload.')
     else:
         try:
             user = User.admin_deserialize_add(user)
             error_messages = user.set_password(password)
             if error_messages:
                 raise BadRequest(', '.join(error_messages))
             else:
                 store.session.add(user)
                 store.session.commit()
                 error_message = mail_actions.request_signup_email_confirmation(user)
                 secret = user.make_api_key()
                 serialized = user.serialize(user)
                 warning_message = 'Failed to send email confirmation: {0}'.format(error_message)
                 response_data = {
                     'data': serialized,
                     'apiKey': secret.key,
                     'warningMessage': warning_message,
                 }
             response = response_data
         except ValidationException as e:
             raise BadRequest(str(e))
     return response
Пример #5
0
    def request_confirm_email():
        requester = get_requesting_user()
        if requester is None:
            raise Unauthorized()
        else:
            error_message = mail_actions.request_signup_email_confirmation(requester)
            if error_message:
                raise InternalServerError(error_message)

        return make_OK_response()
Пример #6
0
 def request_confirm_email():
     requester = get_requesting_user()
     if requester is None:
         response = base_routes.make_not_authorized_response()
     else:
         error_message = mail_actions.request_signup_email_confirmation(requester)
         if error_message:
             response = base_routes.make_server_error_response(error_message)
         else:
             response = base_routes.make_OK_response()
     return response
Пример #7
0
 def request_confirm_email():
     requester = get_requesting_user()
     if requester is None:
         response = base_routes.make_not_authorized_response()
     else:
         error_message = mail_actions.request_signup_email_confirmation(
             requester)
         if error_message:
             response = base_routes.make_server_error_response(
                 error_message)
         else:
             response = base_routes.make_OK_response()
     return response
Пример #8
0
 def usersignup():
     data = request.json
     user = data.get('user', None)
     email = user.get('email', '')
     password = data.get('password', None)
     # Check that the email isn't in use.
     existing_user = store.session.query(User)
     existing_user = existing_user.filter(User.email == email,
                                          User.active == True)
     existing_user = existing_user.first()
     if existing_user is not None:
         response = base_routes.make_bad_request_response(
             'That email address is already associated with an account.', )
     elif password is None:
         response = base_routes.make_bad_request_response(
             'A password was not specified.')
     else:
         try:
             user = User.admin_deserialize_add(user)
             error_messages = user.set_password(password)
             if error_messages:
                 error_message = ', '.join(error_messages)
                 response = base_routes.make_bad_request_response(
                     error_message)
             else:
                 store.session.add(user)
                 store.session.commit()
                 error_message = mail_actions.request_signup_email_confirmation(
                     user)
                 secret = user.make_api_key()
                 serialized = user.serialize(user)
                 warning_message = 'Failed to send email confirmation: {0}'.format(
                     error_message)
                 response_data = {
                     'data': serialized,
                     'apiKey': secret.key,
                     'warningMessage': warning_message,
                 }
             response = jsonify(response_data)
         except ValidationException as e:
             response = base_routes.make_bad_request_response(str(e))
     return response