Fresh install, create admin account, log out => no way to log in

Reproduction Instructions
After this:

(i.e., first use of a fresh install)

  • I was prompted to create an admin account, and I did so by entering an email, username and password
  • I logged out

Expected: there should be a login form asking me for a username and password, or email and password

Observed: this:

Let’s analyze this message:

This Phabricator install is not configured with any enabled authentication providers

That may be true because I hadn’t configured anything. But if that is the case, then:

  • some way of logging in should be enabled by default. I would expect the most obvious one to be: a login form where to enter a username and password
  • if you deem more secure, for whatever reason, to not have even that enabled by default (that doesn’t make sense to me, especially compared to the fact that the first time I simply opened the webpage I was able to create the admin account through the web interface) and I am required to explicitly, manually enable a means of logging in, then you should tell me how to do so during the set-up.

If you have accidentally locked yourself out by disabling all providers

No I haven’t. I simply logged out.

Phabricator/Arcanist Version

cloned from github today

So then I followed the instructions in that screen and ran

./bin/auth recover adminuser

and followed the link to log in again. And I see this:

THAT is what I should have been presented with right after the first login (i.e. right after creating the admin user).

Why did you log out?

Why did you log out?

That’s completely irrelevant to the issue, but I’ll tell you why: I wanted to test (because I am not familiar with Phabricator) to see what another random user visiting the web page would see, to check whether there was any information publicly available to an unregistered user. Actually I thought that the process of setting things up was more close to completion than it was, and that was my mistake, but still I have the “right” to logout just for the fun of it, or accidentally. Usually when I’m logged in somewhere, where I have a username and a password and an email (all of which I had just picked), and I log out I expect to be able to log in again. I now know that it makes total sense that I wouldn’t in this case, but since this is non-obvious to those who are not already familiar to Phabricator or this specific kind of environments, what I said in comment Fresh install, create admin account, log out => no way to log in remains valid: the first thing I should see after creating the admin user (and implicitly logging in as such) should be the warning that no auth provider is configured.

And now forgive me if I reply here with a completely unrelated issue, but I have no choice because:

  • I can’t reply to On a fresh install bin/config complains about "non writable" json file that actually doesn't exist “because” the bug is resolved and “hence” the thread is closed. Is that your normal way of managing bug reports? Maybe it’s because you’re using a forum to do that instead of a proper bug tracker and the only way to mark the bug as resolved is to close the thread? That a bug is resolved shouldn’t mean that nobody can further comment on it. It’s common that someone needs to express concerns that the bug might need to be reopened, or just ask questions to that respect (as in my case)
  • I can’t create a new thread where I meant to point this out, because apparently I have reached the maximum number of topics I can open in my first day. By the way, I should have been told that when clicking on “new topic”, not when trying to submit it after writing it. (at least it gets saved as a draft). And no, I am not going to wait. I am contributing (very little, I am aware of that), I am not asking for help, so you I shouldn’t have to adapt to limitations that are meant to stop spammers.
  • I can’t comment on the commit that fixes the bug because I can’t register an account there (which is fine, I understand that, but I wish I hadn’t wasted time 1 trying to log in, thinking my account from here would work there, given I hadn’t realized that was a different domain, 2 after a couple of failed login attempts which I thought were due to not remembering the correct password, I would submit the login form and it would just keep loading and waiting forever, without any error message, tried several times; 3 trying (in a new incognito window) to log in with google which is an option I had been offered, only to be told google is not enabled as a way to register an account, then why had I been offered the option in the first place -yessss, I understand, because those of you who are already registered can use that to log in - but you do see that the UX is confusing here, right?)

So here’s my reply about On a fresh install bin/config complains about "non writable" json file that actually doesn't exist :
I might be wrong, but I am under the impression that that fix introduces another issue. Correct me if I am wrong: with that fix, now if the json file exists but has syntax errors in it, it will produce the wrong error message, saying that the file isn’t writable, when instead it should say that there are syntax errors in it. This might be relatively minor if that code only gets called during the first configuration attempt right after installation (the file will usually not exist), but still it is not correct - but if the code can be called in other circumstances then it might be a huge issue.

Are you certain you picked a password? If you did, this is a bug.

The expected flow is that you are not asked to set a password. Here’s what the screen looks like – note that there is no “Password” field:

I can’t reproduce being prompted for a password, but if you can give me reproduction instructions for this I’ll fix it.

the first thing I should see after creating the admin user (and implicitly logging in as such) should be the warning that no auth provider is configured.

This should be the first “Setup Issue” in most cases, unless there is an even higher priority setup issue, in which case it should be near the top:

Were you not prompted with this setup issue? If so, this is a bug, but I can’t reproduce it.

This setup issue is non-blocking, but it’s not strictly required that you resolve it. In the past, we got a lot of feedback that Phabricator was difficult and/or time consuming to set up. At the time, many more setup issues were blocking and required resolution before the user was free to choose how to continue. One response to this feedback was to try to get a functional install in front of the user as quickly as possible and make setup issues which were not absolutely critical into nonblocking guidance instead of blocking steps. Along with other changes, this seemed to improve feedback dramatically.

trying (in a new incognito window) to log in with google which is an option I had been offered

My expectation is that the login screen has a large message making it clear that you will not be able to register:

login

Did you not see this guidance? If you saw it but didn’t understand what it meant, how could we rewrite it to be more clear?

it will produce the wrong error message, saying that the file isn’t writable, when instead it should say that there are syntax errors in it.

Because the fix catches FilesystemException, not Exception, the behavior for invalid JSON isn’t masked by the change.

$ # Invalid JSON
$ ./bin/config set test.value 3
[2019-09-08 09:14:43] EXCEPTION: (PhutilProxyException) Configuration file "/Users/epriestley/dev/core/lib/phabricator/conf/local/local.json" exists and is readable, but the content is not valid JSON. You may have edited this file manually and introduced a syntax error by mistake. Correct the file syntax to continue. {>} (PhutilJSONParserException) Parse error on line 4 at column 19: Expected: 'STRING' - It appears you have an extra trailing comma at...
$ # Unwritable File
$ chmod 444 conf/local/local.json 
$ ./bin/config set test.value 3
Usage Exception: Local path "conf/local/local.json" is not writable. This file must be writable so that "bin/config" can store configuration.

It is possible that some other kind of problem could raise a FilesystemException and be reported incorrectly (for example, perhaps a full disk), but I imagine these situations are very rare and that the change is a net positive (i.e., 99% of the time a user hits the message, the new message is more helpful than the old message). The old message wasn’t particularly more specific about very rare conditions, anyway, and we must strike some sort of balance between tailoring the message to the context (“tried to write a file to store configuration”) and explaining the error in detail.

but still I have the “right” to logout just for the fun of it, or accidentally.

The login flow worked fine for you though, right? You were told how to recover access, and that method worked?

And we can’t give you a login/password prompt, at least if things are working as expected: assuming setup went normally, your account does not have a password, so there’s nothing you could type into the field.

I do think a possibly reasonable upstream change here is to add a warning to the logout flow if no authentication providers are configured (“Really really log out? You won’t be able to log in normally because you haven’t configured any authentication providers yet.”), but I think the (expected) behavior here is generally reasonable already. If you were actually prompted for a password or the setup issue didn’t show up those make the flow less reasonable, but they’re bugs.

I do think a possibly reasonable upstream change here is to add a warning to the logout flow if no authentication providers are configured…

I filed this as https://secure.phabricator.com/T13406 and implemented it in https://secure.phabricator.com/D20789.

Sorry, I probably didn’t, you’re right. I knew I had picked a username and entered an email, I guess I just forgot I hadn’t even entered a password.

It wasn’t until much later that I found out that that little “!” icon would unfold a list of setup issues.

Anyway, this sounds like a perfect solution to me:

Regarding the setup issues, a few days ago I did another fresh install of Phabricator on another server (this time I did not log out as I was now more aware of what I needed to do), and I did find this setup issue quite down the list. I don’t remember exactly how many issues were listed before (I’d say like five or more) nor which ones but I remember thinking that this one should have had higher priority than most of those.