Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
id
usermetadb
Commits
d48cc7af
Commit
d48cc7af
authored
Oct 27, 2018
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly support login_method in the db
parent
d6ae7dde
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
server/userlog.go
server/userlog.go
+7
-5
server/userlog_test.go
server/userlog_test.go
+1
-0
No files found.
server/userlog.go
View file @
d48cc7af
...
...
@@ -31,17 +31,17 @@ var userlogDBStatements = map[string]string{
// optional device information).
"insert_userlog"
:
`
INSERT INTO userlog (
username, service, log_type, message, timestamp
username, service, log_type,
login_method,
message, timestamp
) VALUES (
?, ?, ?, ?, ?
?, ?, ?, ?, ?
, ?
)`
,
"insert_userlog_with_device_info"
:
`
INSERT INTO userlog (
username, service, log_type, message, timestamp,
username, service, log_type,
login_method,
message, timestamp,
device_id, device_remote_zone, device_user_agent,
device_browser, device_os, device_mobile
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
, ?
)`
,
// Database maintenance (prune old entries etc).
...
...
@@ -55,7 +55,7 @@ var userlogDBStatements = map[string]string{
// Retrieve logs for a specific user.
"get_user_logs"
:
`
SELECT
service, log_type, message, timestamp,
service, log_type,
login_method,
message, timestamp,
device_id, device_remote_zone, device_user_agent,
device_browser, device_os, device_mobile
FROM
...
...
@@ -164,6 +164,7 @@ func (u *userlogDB) AddLog(entry *usermetadb.LogEntry) error {
entry
.
Username
,
entry
.
Service
,
entry
.
Type
,
entry
.
LoginMethod
,
entry
.
Message
,
entry
.
Timestamp
,
}
...
...
@@ -213,6 +214,7 @@ func (u *userlogDB) GetUserLogs(username string, maxDays, limit int) ([]*usermet
if
err
:=
rows
.
Scan
(
&
e
.
Service
,
&
e
.
Type
,
&
e
.
LoginMethod
,
&
e
.
Message
,
&
e
.
Timestamp
,
&
e
.
DeviceInfo
.
ID
,
...
...
server/userlog_test.go
View file @
d48cc7af
...
...
@@ -120,6 +120,7 @@ func bulkLoadTestLogs(t testing.TB, db *sql.DB) *usermetadb.LogEntry {
entry
.
Username
,
entry
.
Service
,
entry
.
Type
,
entry
.
LoginMethod
,
entry
.
Message
,
entry
.
Timestamp
,
entry
.
DeviceInfo
.
ID
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment