Page 1 of 2

How can I change to single user mode after delete admin acco

Posted: 01 Mar 2014, 16:30
by Narga
Hi,
I'm using multi user from the first installed because I want to use my own username. After created new account, I deleted admin user from phpMyAdmin :? But I so tired with login form screen then I want to use single user mode. I set

Code: Select all

   define('SINGLE_USER_MODE', true);

and got error message:

Code: Select all

SINGLE_USER_MODE is enabled in config.php but default admin account is not found.

I re-create admin user then try again:

Code: Select all

SINGLE_USER_MODE is enabled in config.php but default admin account is not found.

How can I swich to single user mode with my own username after delete admin user used phpMyAdmin :?:

Re: How can I change to single user mode after delete admin

Posted: 01 Mar 2014, 19:57
by fox
>After created new account, I deleted admin user from phpMyAdmin

Well done.

Re: How can I change to single user mode after delete admin

Posted: 01 Mar 2014, 20:24
by mrc0mmand
Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 08:14
by Narga
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

Is that impossible to fix?
mrc0mmand wrote:Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

It's not work, I got the same error message

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 16:17
by AngryChris
mrc0mmand wrote:Why would someone delete admin account? If you at least want to login into your tt-rss instance, recreate admin account with default values:

Code: Select all

INSERT INTO ttrss_users (login, pwd_hash, access_level) VALUES('admin', 'SHA1:5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 10);


Sadly, I don't have an idea, how to change default user for single user mode, because I've never used it before.
(Well, you could probably change name and password of your existing user to default values of admin user, but honestly I don't know if it would work)

Except those aren't the default values (at least not all of them!). You see, one of the side effects of 'admin' being the first user created is that it's id is set to 1. And if you note here in the code:

Code: Select all

if (SINGLE_USER_MODE) {
        $result = db_query("SELECT id FROM ttrss_users WHERE id = 1");

        if (db_num_rows($result) != 1) {
                array_push($errors, "SINGLE_USER_MODE is enabled in config.php but default admin account is not found.");
        }
}

It's looking for a user id of 1. He may be able to recover by setting the id of admin to 1.

Code: Select all

UPDATE ttrss_users SET id='1' WHERE login='admin';

But I'd not hold my breath. I don't know what all else is setup when a user is created beyond what's in the ttrss_users table. This monumental level of "well done" is a bit beyond my understanding. I think the best advice (if the above doesn't work) is:

Code: Select all

DROP DATABASE ttrssdb;

For whatever he's calling it.

Narga wrote:After created new account, I deleted admin user from phpMyAdmin

Incredible.

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 17:02
by mrc0mmand
AngryChris wrote:It's looking for a user id of 1. He may be able to recover by setting the id of admin to 1.


Damn, I totally forgot about that ID, thanks!

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 19:18
by Narga
Thanks AngryChris, I'm still using my current user with more than 300 feeds. I guess if I change the id of my current user I must change it to admin -> the action that make me create a user then delete admin account.
I've tried change ID or edit the code in functions.php, sanity_check.php .... but it's not work. I've gave up and waiting for new feature that allow choose default user after switch to Single User Mode.
Thanks

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 20:25
by dbanet
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 20:56
by charlie-tca
I am not so sure that the ability to delete is what is really stupid here. I, for one, appreciate the idea that the application is written thinking users are smarter than normal.

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 21:54
by dbanet
charlie-tca wrote:I am not so sure that the ability to delete is what is really stupid here. I, for one, appreciate the idea that the application is written thinking users are smarter than normal.

Well if a user wants to shoot himself in his foot, he may make a DELETE request to the database.

Therefor an indeed smart user may shoot himself in his leg anyway, but not-so-smart ones are protected from doing this.

Re: How can I change to single user mode after delete admin

Posted: 02 Mar 2014, 23:26
by sleeper_service
dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.


what's stupid is making a statement like that, the guy said he opened up the raw database in phpmyadmin, and deleted data from it, how exactly would you prevent that, genius?

Re: How can I change to single user mode after delete admin

Posted: 03 Mar 2014, 00:23
by fox
dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.


the stupid is coming from inside the thread

Re: How can I change to single user mode after delete admin

Posted: 03 Mar 2014, 01:58
by AngryChris
dbanet wrote:
fox wrote:>After created new account, I deleted admin user from phpMyAdmin

Well done.

That's stupid the admin user is deletable.

It's not deletable, at least not from in the application. If you try to delete the admin user from the User control page, you get this error:

Code: Select all

Remove selected users? Neither default admin nor your account will be removed.

Re: How can I change to single user mode after delete admin

Posted: 03 Mar 2014, 03:01
by dbanet
Wow how many answers!

I deleted admin user from phpMyAdmin

Well I missed that, indeed. :o
So I have to agree deleting arbitrary rows from the table in hope that it will make just what you want is foolishly.

Re: How can I change to single user mode after delete admin

Posted: 03 Mar 2014, 17:34
by Narga
WoW, Wow, after delete admin user then want to switch to single mode, but in one or more month I'll running it as multiuser, is that stupid question