Skip to content

Commit

Permalink
Merge pull request #1532 from cewert/fix-remember-me
Browse files Browse the repository at this point in the history
Fix remember me bug
  • Loading branch information
1hitsong authored Nov 22, 2023
2 parents 922ebd0 + 8938f57 commit 5904f05
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
6 changes: 0 additions & 6 deletions components/data/UserData.bs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ function setPreference(key as string, value as string)
return set_user_setting("pref-" + key, value)
end function

sub setActive()
if m.global.session.user.settings["global.rememberme"]
set_setting("active_user", m.top.id)
end if
end sub

sub setServer(hostname as string)
m.top.server = hostname
end sub
1 change: 0 additions & 1 deletion components/data/UserData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@
<function name="setPreference" />
<function name="loadFromRegistry" />
<function name="saveToRegistry" />
<function name="setActive" />
</interface>
</component>
5 changes: 2 additions & 3 deletions source/api/userauth.bs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ function get_token(user as string, password as string)

userdata = CreateObject("roSGNode", "UserData")
userdata.json = json

userdata.callFunc("setActive")
userdata.callFunc("saveToRegistry")

return userdata
end function

Expand Down Expand Up @@ -163,8 +162,8 @@ function AuthenticateViaQuickConnect(secret)
userdata.json = jsonResponse
session.user.Update("id", jsonResponse.User.Id)
session.user.Update("authToken", jsonResponse.AccessToken)
userdata.callFunc("setActive")
userdata.callFunc("saveToRegistry")

return true
end if

Expand Down
4 changes: 4 additions & 0 deletions source/utils/session.bs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ namespace session
set_user_setting("username", tmpSession.user.name)
end if

if m.global.session.user.settings["global.rememberme"]
set_setting("active_user", tmpSession.user.id)
end if

session.user.LoadUserPreferences()
end sub

Expand Down

0 comments on commit 5904f05

Please sign in to comment.