hrfee / jfa-go

a bit-of-everything user managament app for Jellyfin
https://jfa-go.com
Other
790 stars 57 forks source link

No mail sent on password reset #233

Closed iluvatyr closed 1 year ago

iluvatyr commented 1 year ago

Read the FAQ first!

Describe the bug Install jfa-go with docker and follow instructions in the install process. Add SMTP configuration and test it (sending an invite to someone per mail or let someone register. See that it works Go to an existing user and select "send password reset" Bug: No mail is sent, but link is created

To Reproduce

  jfa-go:
    image: hrfee/jfa-go
    container_name: jfa-go
    volumes:
      - jfa-go-data:/data
      - jellyfin-conf:/jf:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - 8056:8056 #http
      #- 8057:8057 #https
    networks:
      - jellyfin-network
    restart: unless-stopped

What to do to reproduce the problem.

Logs No error is shown:

INFO] 18:22:09 Sent password reset message to "****@gmail.com" [GIN/DEBUG] 18:22:09: POST(/users/password-reset) => 200 in 4.263578ms;

Configuration

first_run = false

[jellyfin]
; settings for connecting to jellyfin
; it is recommended to create a limited admin account for this program.
username                    = mymail@gmail.com
password                    = *******
; jellyfin server address. can be public, or local for security purposes.
server                      = http://jellyfin:8096
; publicly accessible jellyfin address for invite form. leave blank to reuse the above address.
public_server               = https://jellyfin.mydomain.com
; the name of the client that will show up in the jellyfin dashboard.
client                      = jfa-go
; timeout of user cache in minutes. set to 0 to disable.
cache_timeout               = 30
; note: emby integration works but is missing some features, such as password resets.
type                        = jellyfin
; optionally substitute occurrences of "jellyfin" in the account creation form and emails with this. may result in bad grammar.
substitute_jellyfin_strings = 

[ui]
; settings related to the ui and program functionality.
; default account form language. visit weblate.jfa-go.com if you'd like to translate.
language-form   = en-us
; default admin page language. settings has not been translated. visit weblate.jfa-go.com if you'd like to translate.
language-admin  = en-us
; default appearance for all users.
theme           = Jellyfin (Dark)
; set 0.0.0.0 to run on localhost
host            = 0.0.0.0
port            = 8056
; enable this to use jellyfin users instead of the below username and pw.
jellyfin_login  = true
; allows only admin users on jellyfin to access the admin page.
admin_only      = true
; allow all jellyfin users to access jfa-go. not recommended, add individual users in the accounts tab instead.
allow_all       = false
; username for admin page (leave blank if using jellyfin_login)
username        = your username
; password for admin page (leave blank if using jellyfin_login)
password        = your password
; address to send notifications to (leave blank if using jellyfin_login)
email           = example@example.com
; enables debug logging and exposes pprof as a route (don't use in production!)
debug           = false
; displayed at bottom of all pages except admin
contact_message = Need help? contact me on jellyfin@mydomain.com
; displayed at top of invite form.
help_message    = Enter your details to create an account.
; displayed when a user creates an account
success_message = Your account has been created. Click below to continue to Jellyfin.
; url base for when running jfa-go with a reverse proxy in a subfolder. include preceding /, e.g "/accounts".
url_base        = 
; set a different url for the sign-up form to redirect the user to when they've signed up. default to 'public server' or 'server' in the jellyfin tab.
redirect_url    = 

[password_validation]
; password validation (minimum length, etc.)
enabled    = true
min_length = 8
upper      = 1
lower      = 1
number     = 1
special    = 0

[messages]
; general settings for emails/messages.
; enable the sending of emails/messages such as password resets, announcements, etc.
enabled     = true
use_24h     = true
; date format used in emails. follows datetime.strftime format.
date_format = %d/%m/%y
; message displayed at bottom of emails.
message     = Need help? contact me on jellyfin@mydomain.com

[email]
; general email settings.
; default email language. submit a pr on github if you'd like to translate.
language    = en-us
; use email address from invite form as username on jellyfin.
no_username = true
; method of sending email to use.
method      = smtp
; address to send emails from
address     = jellyfin@mydomain.com
; the name of the sender
from        = Jellyfin
; send emails as plain text instead of html.
plaintext   = false
; require an email address on sign-up.
required    = true

[smtp]
; smtp server connection settings.
; username for smtp. leave blank to user send from address as username.
username        = mydomain
; your email provider should provide different ports for each encryption method. generally 465 for ssl_tls, 587 for starttls.
encryption      = starttls
; smtp server address.
server          = ***
port            = 587
password        = **
; hostname sent when sending hello to the smtp server. some servers don't like the default "localhost" value, such as smtp-relay.gmail.com.
hello_hostname  = localhost
; use if your smtp server's ssl certificate is not trusted by the system.
ssl_cert        = 
; warning, disabling this makes you much more vulnerable to man-in-the-middle attacks
cert_validation = true

[password_resets]
; settings for the password reset handler.
; enable to store provided email addresses, monitor jellyfin directory for pw-resets, and send reset pins
enabled         = true
; path to the folder jellyfin puts password-reset files.
watch_directory = /jf
; send users a link to reset their password instead of a pin. must be enabled to reset ombi password at the same time as the jellyfin password.
link_reset      = true
; instead of automatically setting the user's password to the pin, allow them to set a new password through the reset link.
set_password    = true
; base url for jfa-go. you can leave this if you have one set in "invite emails". this is necessary because using a reverse proxy means the program has no way of knowing the url itself.
url_base        = 
; default language for password reset success screen.
language        = en-us
; path to custom email html
email_html      = 
; path to custom email in plain text
email_text      = 
; subject of password reset emails.
subject         = Jellyfin Password Reset

[invite_emails]
; settings for sending invites directly to users.
enabled    = true
; path to custom email html
email_html = 
; path to custom email in plain text
email_text = 
; subject of invite emails.
subject    = Invite: Watch Movies and Series on Jellyfin
; base url for jfa-go. this is necessary because using a reverse proxy means the program has no way of knowing the url itself.
url_base   = accounts-jellyfin.mydomain.com

[template_email]
; settings for the template used for announcements & custom messages. html should include {{ .text }}, plaintext should include {{ .plaintext }}, and either can have {{ .message }} to include the contact message.
; path to custom email html template for announcements/custom messages.
email_html = 
; path to custom email text template for announcements/custom messages.
email_text = 

[welcome_email]
; optionally send a welcome message to new users with the jellyfin url and their username.
; enable to send welcome emails to new users.
enabled    = true
; subject of welcome emails.
subject    = Welcome to Jellyfin mydomain
; path to custom email html
email_html = 
; path to custom email in plain text
email_text = 

[files]
; optional settings for changing storage locations.
; location of stored invites (json).
invites         = 
; location of stored non-jellyfin password resets (json).
password_resets = 
; location of stored email addresses (json).
emails          = 
; stores users temporarily when a user expiry is set.
users           = 
; location of stored ombi user template.
ombi_template   = 
; location of stored user profiles (encompasses template and configuration and displayprefs) (json)
user_profiles   = 
; path to directory containing custom versions of web ui pages. see wiki for more info.
html_templates  = 
; the path to a directory which following the same form as the internal 'lang/' directory. see github for more info.
lang_files      = 
; json file generated by program in settings, different from email_html/email_text. see wiki for more info.
custom_emails   = 
; stores telegram user ids and language preferences.
telegram_users  = 
; stores matrix user ids and language preferences.
matrix_users    = 
; stores cryptographic material for matrix end-to-end encryption.
matrix_sql      = 
; stores discord user ids and language preferences.
discord_users   = 
; stores custom announcement templates.
announcements   = 

Platform/Version

Include the platform jfa-go is running on (e.g Windows, Linux, Docker), the version (first line of output by jfa-go or Settings>About in web UI), and if necessary the browser version and platform.

gaming09 commented 1 year ago

Same issue here, weridly enough i can send to the main acct for the email provider im using but it wont send to anyone else

gaming09 commented 1 year ago

Edit - Discovered if the user isnt created from the jfa-go interface you cant send email notifications to them.

hrfee commented 1 year ago

@gaming09 you're right, users created within Jellyfin, who have had an email address attached through jfa-go can't be sent mail for me either. Usually there's a little cog next to users with contact info in jfa-go, where you can set which methods to contact through. When manually adding an email address, the preference for email contact isn't automatically set to true, but currently the cog to change it only shows up when there's discord/matrix/telegram contact info. I'll fix both:

hrfee commented 1 year ago

Contact can be manually enabled through the cog next to the email address in the Accounts tab, this will only be necessary until I finish some other work that's stopping me committing the rest of the code for this issue.

hrfee commented 1 year ago

Should all be fixed now. For existing users you can't send to, enable it in with the little cog.

JPKribs commented 1 year ago

I just switched to the docker unstable branch but I haven't been able to get this to work with users created outside of JFA-GO. I've removed and re-added the emails for the users and restarted Jellyfin and JFA-GO. I can confirm this works for users created in JFA-GO. Is there anything special I need to do to enable this? Or maybe I'm on the wrong branch?

Thanks for this update and tool! Sorry in advance for the dumb questions!

JPKribs commented 1 year ago

Never mind I figured it out! Manually updating the contact flag to True in the emails.json resolves this. For whatever reason, the other users had it True but the user I was testing on was still False. Manually updating resolved it for that user.

hrfee commented 1 year ago

@Jpkribs were you not able to enable contact with the cog icon?

JPKribs commented 1 year ago

Sorry for the delay! So fully deleting the email that was added on the docker:latest then re-adding it on docker:unstable was the issue. Editing the email didn't change the flag but entering a new email from scratch flipped the contact flag.

I'm not sure if that answers your question but everything seems to be working now!