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