goniszewski / grimoire

Bookmark manager for the wizards 🧙
https://grimoire.pro
MIT License
1.99k stars 58 forks source link

After first install login not possible with initial user "Incorrect credentials" #43

Closed gebi closed 8 months ago

gebi commented 8 months ago

Describe the bug docker-compose up "install" produces non working instance, no idea how to login when all i get is Incorrect credentials.

% grep -v '^#' .env
PUBLIC_POCKETBASE_URL=
ROOT_ADMIN_EMAIL=m.gebetsr@gmail.com
ROOT_ADMIN_PASSWORD=test123
ORIGIN=http://localhost:5173
PUBLIC_HTTPS_ONLY=
PORT=5173
PUBLIC_SIGNUP_DISABLED=false
% docker compose up
[+] Running 2/2
 ✔ Container grimoire-pocketbase  Recreated                                                                                                0.1s
 ✔ Container grimoire             Recreated                                                                                                0.1s
Attaching to grimoire, grimoire-pocketbase
grimoire-pocketbase  | 2024/01/06 03:26:54 Server started at http://0.0.0.0:80
grimoire-pocketbase  | ├─ REST API: http://0.0.0.0:80/api/
grimoire-pocketbase  | └─ Admin UI: http://0.0.0.0:80/_/
grimoire             | Listening on 0.0.0.0:5173
grimoire             | { invalid: true }
grimoire             | { invalid: true }

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/goniszewski/grimoire
  2. edit .env
  3. docker compose up
  4. go to http://localhost:5173/login, try to login -> invalid credentials with the pw defined from .env

Expected behavior be able to login with the email/pw defined in .env

Screenshots image

Desktop (please complete the following information):

goniszewski commented 8 months ago

Hello @gebi, thank you for bringing this up!

This is not a bug, but a feature (maybe not the best one). It should be stated in a clearer way, but in fact the credentials you are filling in .env file are meant for the Root Admin. The actual Users need to be registered using the Signup form (<GRIMOIRE_URL>/signup).

Perhaps the initial User should be created alongside the Root Admin. Would it be more intuitive (Admins and Users are strictly separated and do not share any features, even use different DB tables)?

gebi commented 8 months ago

oh, ok... i got it working with creating a new user with /signup, strange but ok :). Having an initial user would be nice, ack especially for testing it out locally.

i've no idea what a root admin is or should do, i tried the docker compose internal 172er ip on port 80 with path /_/ (http://172.18.0.2/_/#/login where i then get a pocketbase admin sign-in) but there too i just get a invalid credentials

with a 400 bad request on POST to http://172.18.0.2/api/admins/auth-with-password Payload {identity: "MY-EMAIL", password: "MY-PASSWORD"} Response {"code":400,"message":"Failed to authenticate.","data":{}}

i'm really sorry to nag you with that but i just wanted to quickly try out grimoire locally with the suggested docker compose method.

goniszewski commented 8 months ago

Admins have their designated dashboard (under <GRIMOIRE_URL>/admin), but atm their role is focused around changing the configuration of PocketBase (like setting backups, SMTP etc.). If you cannot log in with the credentials you specified in the .env file, maybe the first migration did proceed with the default values?

If that's the case, please try it again with email admin@grimoire.localhost and password changeme.

gebi commented 8 months ago

no idea what happened i just got this error below. anyway, i've inserted the bcrypt from the user table in pb_data/data.db to _admin table and now the expected pw works.

grimoire             |   status: 400,
grimoire             |   response: { code: 400, message: 'Failed to authenticate.', data: {} },
grimoire             |   isAbort: false,
grimoire             |   originalError: {
grimoire             |     url: 'http://pocketbase/api/admins/auth-with-password',
grimoire             |     status: 400,
grimoire             |     data: { code: 400, message: 'Failed to authenticate.', data: {} }
grimoire             |   }

but creating an initial admin and bookmark user and some description to which URL the login works would be awesome :)!