sqldb cleanup

This commit is contained in:
Jörn-Michael Miehe 2019-05-09 14:33:43 +02:00
parent 0f7176999b
commit d4358479f6

View file

@ -99,14 +99,13 @@ class FFTCGDB
stmt.finalize()
if err
logger.warn "reg: FAIL db '#{err.code}' for '#{login}'"
reject messages.exists # user already exists
# user already exists
reject messages.exists
else
logger.info "reg: OK '#{login}'"
# registration successful
resolve
user: @lastID
login: login
resolve null
.catch ->
reject messages.empty
@ -117,7 +116,7 @@ class FFTCGDB
@validate login, password
.then =>
# get users table row
stmt = @db.prepare 'SELECT user, login, pwdhash FROM users WHERE login = ?'
stmt = @db.prepare 'SELECT * FROM users WHERE login = ?'
stmt.get [login], (err, row) =>
stmt.finalize()
if err
@ -142,6 +141,7 @@ class FFTCGDB
resolve
user: row.user
login: row.login
settings: row.settings
else
logger.debug "login: FAIL password for '#{login}'"