Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication Failure Discord Notification Type overwrites the {{Username}} Variable #276

Open
Nicsena opened this issue Sep 6, 2024 · 5 comments · May be fixed by #281
Open

Authentication Failure Discord Notification Type overwrites the {{Username}} Variable #276

Nicsena opened this issue Sep 6, 2024 · 5 comments · May be fixed by #281

Comments

@Nicsena
Copy link

Nicsena commented Sep 6, 2024

I am using the Discord Destination Option in Jellyfin Webhook with Authentication Success, and Authentication Failure Notification Types. I am using Jellyfin Server Version: v10.9.6 with Webhook Plugin 14.0.0.0 (from the Stable Jellyfin Repo).

When Authentication Failure occurs, the {{Username}} variable shows the Webhook Username that was specified in settings instead of a user's username.

My template:

{
    "content": "{{MentionType}}",
    "username": "{{BotUsername}}",
    "embeds": [
        {
            {{#if_equals NotificationType 'AuthenticationSuccess'}}
                "title": "User - New Login",
            {{else}}
                {{#if_equals NotificationType 'AuthenticationFailure'}}
                    "title": "User - Login Failed",
                {{else}}
                    "title": "Unsupported Notification Type",
                {{/if_equals}}
            {{/if_equals}}

            {{#if_equals NotificationType 'AuthenticationSuccess'}}
                "description": "User Authentication - Success",
            {{else}}
                {{#if_equals NotificationType 'AuthenticationFailure'}}
                    "description": "User Authentication - Failed",
                {{else}}
                    "description": "Unsupported Notification Type",
                {{/if_equals}}
            {{/if_equals}}

            {{#if_equals NotificationType 'AuthenticationSuccess'}}
            "fields": [
                    {
                        "name": "Username",
                        "value": "{{NotificationUsername}}",
                        "inline": false
                    },
                    {
                        "name": "Last Login",
                        "value": "{{LastLoginDate}}",
                        "inline": true
                    },
                    {
                        "name": "Last Activity",
                        "value": "{{LastActivityDate}}",
                        "inline": true
                    }
                ],
            {{else}}
                {{#if_equals NotificationType "AuthenticationFailure"}}
                    "fields": [
                        {
                            "name": "Username",
                            "value": "{{Username}}",
                            "inline": false
                        }
                    ],
                {{/if_equals}}
            {{/if_equals}}
            "color": {{#if_equals NotificationType 'AuthenticationSuccess'}} 3329857 {{else}} {{#if_equals NotificationType "AuthenticationFailure" }} 15286079 {{else}} {{EmbedColor}} {{/if_equals}} {{/if_equals}},
            "footer": {
                "text": "{{ServerName}} | Jellyfin Server v{{ServerVersion}}"
            }
        }
    ]
}

Images:

Webhook Settings Screen:
Screenshot 2024-09-05 at 7 45 17 PM

Login Screen:
Screenshot 2024-09-05 at 7 37 34 PM

Discord Notification is not showing the username (user), but instead is showing the specified Webhook Username.
Screenshot 2024-09-05 at 7 33 19 PM

@crobibero
Copy link
Member

Yeah I had realized that a while back so "NotificationUsername" was added. See if that works for you

@Nicsena
Copy link
Author

Nicsena commented Sep 6, 2024

Yeah I had realized that a while back so "NotificationUsername" was added. See if that works for you

It doesn't work. {{NotificationUsername}} returns blank when Authentication Failure occurs.

I also tried this with a new Jellyfin server installation that's running on my main computer just for this github issue.

image

@nylimited
Copy link

Yeah I had realized that a while back so "NotificationUsername" was added. See if that works for you

Thanks for that! Will try it here also. As far as you know, is there a comprehensive list of these variables someplace that I could reference and have no located yet?

@crobibero
Copy link
Member

All variables are listed in the repo readme.

@nylimited
Copy link

All variables are listed in the repo readme.

Thanks you. I obviously missed it somehow... my bad.

@chiragkrishna chiragkrishna linked a pull request Sep 7, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants