Creating the first user

40 views
Skip to first unread message

tgunr

unread,
Dec 1, 2010, 8:41:08 PM12/1/10
to Shine
The docs say simply create a user in the DB, but no clues as to how to
create the user password! I have tried several methods or trying to
create a user password so I can log in to no avail. How do you make
the user password to be entered into the user table?

Stephen Booth

unread,
Jan 6, 2011, 1:26:37 PM1/6/11
to Shine
I had trouble at first as well, but part of the pain was that I wanted
to store hashed passwords and not plaintext passwords. I don't think
there is a ever a reason to store a plaintext password in a database.

So obviously the first thing to do is to edit your class.config.php
and set useHashedPasswords to true and authSalt to something random.
The password stored in the database will be the SHA1 hash of the
user's password with authSalt appended.

So, let's say that the password is 'foo' and the salt is 'bar'. Then
the password will be the SHA1 hash of 'foobar'.

I used PHPMyAdmin to do the insertion, but you could also use mysql
directly. I think the code to insert a new user would look like:

INSERT INTO 'shine_users' (username, password, level) VALUES
('sbooth', SHA1('foobar'), 'admin');
Reply all
Reply to author
Forward
0 new messages