Exemple #1
0
def admin_add_users(user, *args, **kwargs):
    data = request.get_json()
    try:
        data['user_id'] = int(data['user_id'])
    except:
        abort(400)
    new_user = User(**data)
    password = new_user.reset_password()
    new_user.active = True
    new_user.save()
    return jsonify({
        'success': True,
        'password': password,
        'api_token': user.api_token
    })
Exemple #2
0
def admin_add_users(user, *args, **kwargs):
    data = request.get_json()
    try:
        data["user_id"] = int(data["user_id"])
    except:
        abort(400)
    new_user = User(**data)
    password = new_user.reset_password()
    new_user.active = True
    new_user.save()
    return jsonify({
        "success": True,
        "password": password,
        "api_token": user.api_token
    })