skydread1/flybot.sg

User roles are duplicated when logging in/out

flybot-nam-nguyenhoai opened this issue · 0 comments

Problem

When a user logs out and in again, their user roles are duplicated.

Steps to reproduce

  1. Clone this repository.
  2. Provide the necessary authentication files: oauth2.edn and admin.edn (see Configuration files).
  3. Initialize the website for web development (see Front-end dev setup).
  4. Log in to the website and check @re-frame.db/app-db in the ClojureScript REPL.
    The user (in :app/user) should contain roles like these (note the duplicate entries):
    [#:role{:name :editor,
            :date-granted #inst "2023-07-24T09:41:00.000-00:00"}
     #:role{:name :admin,
            :date-granted #inst "2023-07-24T09:41:00.000-00:00"}
     #:role{:name :editor,
            :date-granted #inst "2023-07-24T09:41:00.000-00:00"}
     #:role{:name :admin,
            :date-granted #inst "2023-07-24T09:41:00.000-00:00"}]
  5. Log out and log in again n times, then check @re-frame.db/app-db in the ClojureScript REPL.
    The user should contain the same roles as above, duplicated exactly 2n more times.

Suggestion

Remove user roles before updating user information during login.