

def register_user(**kwargs):
    (confirmation_link, token) = (None, None)
    kwargs['password'] = encrypt_password(kwargs['password'])
    user = _datastore.create_user(**kwargs)
    _datastore.commit()
    if _security.confirmable:
        (confirmation_link, token) = generate_confirmation_link(user)
        do_flash(*get_message('CONFIRM_REGISTRATION', email=user.email))
    user_registered.send(app._get_current_object(), user=user, confirm_token=token)
    if config_value('SEND_REGISTER_EMAIL'):
        send_mail(config_value('EMAIL_SUBJECT_REGISTER'), user.email, 'welcome', user=user, confirmation_link=confirmation_link)
    return user

dataset/ETHPy150Open mattupstate/flask-security/flask_security/registerable.py register_user/original