New User Local Authentication Cannot Login


#1

Gitea, default installation with sqlite3 on a Linux server. No email server setup.

As administrator I added a new user via the web interface and assigned a password for the user.

That user has Activated checked and cannot login. I tried changing the password, but it still does not allow login.

Any ideas to allow this user to login?


#2

Can you check if the “Login disabled” flag is checked on the edit account page? here:

image

Also, can you tell us if the console or the logs show any error message after the request to the login page?


#3

“Login disabled” is not checked. I added some log entries replacing actual user name with “newusername”. Current log setting is “Trace”.

gitea.log

2018/04/26 12:08:34 [D] Session ID: c2c130cdd9894bad
2018/04/26 12:08:34 [D] CSRF Token: V_rQ_STcnHl4prIFYc1rJkGSS5U6MTUyNDc2Mzc3NTU1ODE3NTI1Mw==
2018/04/26 12:08:34 [D] Template: user/auth/signin
2018/04/26 12:08:34 [I] Failed authentication attempt for newusername

xorm.log

2018/04/26 12:08:34 [I] [SQL] SELECT `id`, `type`, `name`, `is_actived`, `is_sync_enabled`, `cfg`, `created_unix`, `updated_unix` FROM `login_source` WHERE (is_actived = ? and type = ?) []interface {}{true, 6}
2018/04/26 12:08:34 [I] [SQL] SELECT `id`, `lower_name`, `name`, `full_name`, `email`, `keep_email_private`, `passwd`, `login_type`, `login_source`, `login_name`, `type`, `location`, `website`, `rands`, `salt`, `created_unix`, `updated_unix`, `last_login_unix`, `last_repo_visibility`, `max_repo_creation`, `is_active`, `is_admin`, `allow_git_hook`, `allow_import_local`, `allow_create_organization`, `prohibit_login`, `avatar`, `avatar_email`, `use_custom_avatar`, `num_followers`, `num_following`, `num_stars`, `num_repos`, `description`, `num_teams`, `num_members`, `diff_view_style` FROM `user` WHERE `lower_name`=? LIMIT 1 []interface {}{"newusername"}

#4

From a quick look on the source code, I would assume it doesn’t find the target user. Can you try running this query on the SQLite database?

SELECT `id` FROM `user` WHERE `lower_name`='newusername' LIMIT 1

You should be able to access sqlite by doing sqlite3 database.db.


#5

I’ve been looking at the database and trying to compare my account with the new user.

The sql runs OK and returns the new user based on the lower_name.

New user has:

last_repo_visibilty = 0
is_admin = 0
diff_view_style =

My Account has:

last_repo_visibilty = 1
is_admin = 1
diff_view_style = unified


#6

Do you have by any chance log in with alternative sources set up? (LDAP, OAuth2, OpenID, other login sources…)


#7

Yeah I want to setup LDAP, but that’s always a pain for me.

We have any examples of LDAP setup in gitea with Active Directory?

Cheers


#8

Let’s focus on the issue at hand first. Do you want to set up LDAP (in the sense that you still have to go through the process) or is it already partially or completely setup? (so that it may interfere with the login for the said user?)


#9

No LDAP setup attempted, but it was my next step if I couldn’t get Local Authentication working.

Any log settings to get more info?

Currently trying to see what models package does.


#10

I was able to create a test new user and login by using the “Sign up now” feature.

Those I created from the Admin page could not authenticate.

So I have a workaround.


#11

Interesting. I tried to replicate on my 1.4.0 install, but I can’t seem to. Can you create an issue on GitHub providing more information about the version and logs you posted here? Thanks!

Happy to see that we have a workaround at least :smiley:


#12

I was re-testing this problem and taking a backup of the Sqlite3 db file to trace/debug and it seems to be working correctly now.

Nothing I did other than restarting gitea. But I had done that before with no resolution.

So the problem resolved itself I guess. Onward to other things.


#13

lucky you are.hi did gitea ever tell you the database file is readonly? lol!! it does tell me very often,and then,some how it just fix it self,

:roll_eyes:

maybe it just skip test,so it break at i click the button which continue installing.and if you figure out why ?could you please send me a msg:joy:?im pretty crazy about this now,yes,sad:cold_sweat: and :hot_face:angry maybe.real upsetted now.