Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add support for new AuthUser fields

  • Loading branch information...
commit 277ab64c91a84278f133aee0ef8d22732b62365c 1 parent 7aa36b4
Ozgun Ataman authored

Showing 1 changed file with 8 additions and 0 deletions. Show diff stats Hide diff stats

  1. +8 0 src/Snap/Extension/DB/MongoDB.hs
8 src/Snap/Extension/DB/MongoDB.hs
@@ -267,6 +267,10 @@ docToAuthUser v = do
267 267 , userSuspendedAt = DB.lookup "suspended_at" v
268 268 , userCreatedAt = DB.lookup "created_at" v
269 269 , userUpdatedAt = DB.lookup "updated_at" v
  270 + , userCurrentLoginAt = DB.lookup "current_login_at" v
  271 + , userLastLoginAt = DB.lookup "last_login_at" v
  272 + , userCurrentLoginIp = DB.lookup "current_login_ip" v
  273 + , userLastLoginIp = DB.lookup "last_login_ip" v
270 274 , userLoginCount = maybe 0 id $ DB.lookup "login_count" v
271 275 , userFailedLoginCount = maybe 0 id $ DB.lookup "failed_login_count" v
272 276 }
@@ -289,6 +293,10 @@ authUserToDoc usr = fields'
289 293 , Just $ ("salt" =: userSalt usr)
290 294 , Just $ ("activated_at" =: userActivatedAt usr)
291 295 , Just $ ("suspended_at" =: userSuspendedAt usr)
  296 + , Just $ ("current_login_at" =: userCurrentLoginAt usr)
  297 + , Just $ ("last_login_at" =: userLastLoginAt usr)
  298 + , Just $ ("current_login_ip" =: userCurrentLoginIp usr)
  299 + , Just $ ("last_login_ip" =: userLastLoginIp usr)
292 300 , Just $ ("login_count" =: userLoginCount usr)
293 301 , Just $ ("failed_login_count" =: userFailedLoginCount usr)
294 302 ]

0 comments on commit 277ab64

Please sign in to comment.
Something went wrong with that request. Please try again.