gitea: SMTP-Auth broken in gitea 1.18.0+rc0

Description

There are two problems with smtp auth in gitea:

  1. One can create an Authentication Source in the web UI, but you can not edit it by clicking the pencil button. On doing so the 500 page is shown and in the logs you get this
gitea1.18 | 2022/11/09 20:23:38 [636bfe33] router: completed GET /user/events for 87.123.115.202:0, 200 OK in 7182.9ms @ events/events.go:19(events.Events)
gitea1.18 | 2022/11/09 20:23:38 ...s/context/context.go:219:HTML() [D] [636bfe3a] Template: admin/auth/edit
gitea1.18 | 2022/11/09 20:23:38 ...s/context/context.go:232:HTML() [E] [636bfe3a] Render failed: template: admin/auth/edit:199:58: executing "admin/auth/edit" at <$cfg.Host>: can't evaluate field Host in type convert.Conversion
gitea1.18 | 2022/11/09 20:23:38 ...s/context/context.go:219:HTML() [D] [636bfe3a] Template: status/500
gitea1.18 | 2022/11/09 20:23:38 [636bfe3a] router: completed GET /admin/auths/1 for 87.123.115.202:0, 500 Internal Server Error in 7.2ms @ admin/auths.go:320(admin.EditAuthSource)
  1. Users can not authenticate using the smtp authentication source (even in an upgraded install where smtp-auth used to work flawlessly) When a user tries to log in, an empty page is shown.
    In the logs one can see this:
gitea1.18 | 2022/11/09 20:12:49 ...ers/web/auth/auth.go:221:SignInPost() [E] [636bfbb1] UserSignIn: dial tcp :587: connect: connection refused
gitea1.18 | 2022/11/09 20:12:49 [636bfbb1] router: completed POST /user/login for 87.123.115.202:0, 0  in 1.8ms @ auth/auth.go:177(auth.SignInPost)

I checked these things:

  • Problem happenes with a fresh install and my upgraded install
  • Problem does not happen with gitea 1.17.3 (fresh install and upgraded from previous versions)
  • Smtp-Server is reachable and can be used to authenticate (works for gitea 1.17.3)
  • Username and password are correct (used keepass to auto-type in 1.18-rc0 and 1.17.3)
  • no customization at all, just set up via docker, added authorization source, added user

Gitea Version

1.18-rc0 (docker image gitea:latest)

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

not relevant

Operating System

Linux (docker)

How are you running Gitea?

Used this docker-compose.yml

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:latest
    container_name: gitea1.18
    environment:
      - USER_UID=1002
      - USER_GID=1002
    restart: always
    expose:
      - 22
      - 3000
    networks:
      - gitea
    volumes:
      - ./gitea:/data
#      - /home/git/.ssh:/data/git/.ssh
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "127.0.0.1:2222:22"

docker image ls:

REPOSITORY                  TAG           IMAGE ID       CREATED         SIZE
...
gitea/gitea                 latest        54e1c09fe090   2 weeks ago     255MB
...

Database

SQLite

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (9 by maintainers)

Commits related to this issue

Most upvoted comments

It helps that I really do know this codebase - but assuming that you know any imperative language then go is extremely easy to learn.

Ah! The fallbacks won’t work due to a mistaken assumption by the author of the PR.

The merged PRs are in:

I still owe a feedback: The change works for me.

Thank you

Thanks for the fix. I will give it a try later today.

And praise to backups …