diff --git a/internal/handlers/handler_register_totp.go b/internal/handlers/handler_register_totp.go index ae6326584..6d9942c1c 100644 --- a/internal/handlers/handler_register_totp.go +++ b/internal/handlers/handler_register_totp.go @@ -17,8 +17,9 @@ func identityRetrieverFromSession(ctx *middlewares.AutheliaCtx) (*session.Identi } return &session.Identity{ - Username: userSession.Username, - Email: userSession.Emails[0], + Username: userSession.Username, + DisplayName: userSession.DisplayName, + Email: userSession.Emails[0], }, nil } diff --git a/internal/handlers/handler_reset_password_step1.go b/internal/handlers/handler_reset_password_step1.go index e6717f9b4..9c8704410 100644 --- a/internal/handlers/handler_reset_password_step1.go +++ b/internal/handlers/handler_reset_password_step1.go @@ -29,8 +29,8 @@ func identityRetrieverFromStorage(ctx *middlewares.AutheliaCtx) (*session.Identi return &session.Identity{ Username: requestBody.Username, - Email: details.Emails[0], DisplayName: details.DisplayName, + Email: details.Emails[0], }, nil } diff --git a/internal/notification/smtp_notifier.go b/internal/notification/smtp_notifier.go index 34fcbd7b2..7afda8426 100644 --- a/internal/notification/smtp_notifier.go +++ b/internal/notification/smtp_notifier.go @@ -56,7 +56,9 @@ func NewSMTPNotifier(config *schema.SMTPNotifierConfiguration, certPool *x509.Ce at := strings.LastIndex(config.Sender.Address, "@") if at >= 0 { - domain = config.Sender.Address[at:] + domain = config.Sender.Address[at+1:] + } else { + domain = "localhost.localdomain" } return &SMTPNotifier{ diff --git a/internal/utils/crypto.go b/internal/utils/crypto.go index 0d0f3cfd9..c8b7451db 100644 --- a/internal/utils/crypto.go +++ b/internal/utils/crypto.go @@ -603,8 +603,8 @@ func RandomInt(n int) (int, error) { max := big.NewInt(int64(n)) - if max.IsUint64() { - return 0, fmt.Errorf("generated max is uint64") + if !max.IsUint64() { + return 0, fmt.Errorf("generated max is negative") } value, err := rand.Int(rand.Reader, max)