def METHOD_NAME():
    """
    Update user setting
    Input:
    - notification: bool
    - alias_generator: word|uuid
    - random_alias_default_domain: str
    """
    user = g.user
    data = request.get_json() or {}
    if "notification" in data:
        user.notification = data["notification"]
    if "alias_generator" in data:
        alias_generator = data["alias_generator"]
        if alias_generator not in ["word", "uuid"]:
            return jsonify(error="Invalid alias_generator"), 400
        if alias_generator == "word":
            user.alias_generator = AliasGeneratorEnum.word.value
        else:
            user.alias_generator = AliasGeneratorEnum.uuid.value
    if "sender_format" in data:
        sender_format = data["sender_format"]
        if not SenderFormatEnum.has_name(sender_format):
            return jsonify(error="Invalid sender_format"), 400
        user.sender_format = SenderFormatEnum.get_value(sender_format)
        user.sender_format_updated_at = arrow.now()
    if "random_alias_suffix" in data:
        random_alias_suffix = data["random_alias_suffix"]
        if not AliasSuffixEnum.has_name(random_alias_suffix):
            return jsonify(error="Invalid random_alias_suffix"), 400
        user.random_alias_suffix = AliasSuffixEnum.get_value(random_alias_suffix)
    if "random_alias_default_domain" in data:
        default_domain = data["random_alias_default_domain"]
        sl_domain: SLDomain = SLDomain.get_by(domain=default_domain)
        if sl_domain:
            if sl_domain.premium_only and not user.is_premium():
                return jsonify(error="You cannot use this domain"), 400
            user.default_alias_public_domain_id = sl_domain.id
            user.default_alias_custom_domain_id = None
        else:
            custom_domain = CustomDomain.get_by(domain=default_domain)
            if not custom_domain:
                return jsonify(error="invalid domain"), 400
            # sanity check
            if custom_domain.user_id != user.id or not custom_domain.verified:
                LOG.w("%s cannot use domain %s", user, default_domain)
                return jsonify(error="invalid domain"), 400
            else:
                user.default_alias_custom_domain_id = custom_domain.id
                user.default_alias_public_domain_id = None
    Session.commit()
    return jsonify(setting_to_dict(user))