perara / wg-manager

A easy to use WireGuard dashboard and management tool
MIT License
599 stars 72 forks source link

Unable to login #100

Closed flippy1345 closed 3 years ago

flippy1345 commented 3 years ago

I'm unable to login. When I look into the logs it seems like it wants to find something in a DB.

To Reproduce Steps to reproduce the behavior:

  1. Deploy Docker Container with the provided compose text.
  2. Try to login
  3. Receive error 401 in the browser console

Platform:

Docker Log Output:

{"log":"No row was found for one()\n","stream":"stderr","time":"2021-06-07T07:13:20.310905251Z"}
{"log":"Traceback (most recent call last):\n","stream":"stderr","time":"2021-06-07T07:13:20.310962204Z"}
{"log":"  File \"/app/schemas.py\", line 74, in from_db\n","stream":"stderr","time":"2021-06-07T07:13:20.310972704Z"}
{"log":"    db_item = self.filter_query(sess).one()\n","stream":"stderr","time":"2021-06-07T07:13:20.310981512Z"}
{"log":"  File \"/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py\", line 3500, in one\n","stream":"stderr","time":"2021-06-07T07:13:20.310996764Z"}
{"log":"    raise orm_exc.NoResultFound(\"No row was found for one()\")\n","stream":"stderr","time":"2021-06-07T07:13:20.311006516Z"}
{"log":"sqlalchemy.orm.exc.NoResultFound: No row was found for one()\n","stream":"stderr","time":"2021-06-07T07:13:20.311014208Z"}

Docker Compose File:

version: "2.1"
services:
  wireguard:
    container_name: wg-manager
    image: perara/wg-manager
    restart: always
    sysctls:
      net.ipv6.conf.all.disable_ipv6: 0  # Required for IPV6
    cap_add:
      - NET_ADMIN
    #network_mode: host # Alternatively
    ports:
       - 51800-51900:51800-51900/udp
       - 8888:8888
    volumes:
      - ./wg-manager:/config
    environment:
      HOST: 0.0.0.0
      PORT: 8888
      ADMIN_PASSWORD: admin
      ADMIN_USERNAME: admin
      WEB_CONCURRENCY: 1
tabsmann commented 3 years ago

I have the same issue and I'd like to add that this only happens when you set a password different than admin in the compose file. (For testing purposes I left it as admin and it worked then)

flippy1345 commented 3 years ago

Okay I just noticed why it didn't work and why for @tabsmann and me only admin admin worked, due to username normally coming before the password I defined in the compose file the username as my password. So I was able to login via: ADMIN_PASSWORD:pw123 ADMIN_USERNAME:admin

Instead of how I assumed the order was: ADMIN_USERNAME:admin ADMIN_PASSWORD:pw123

flippy1345 commented 3 years ago

101

I adjusted the order of those to fields.