Merge pull request #1532 from cewert/fix-remember-me

Fix remember me bug
This commit is contained in:
1hitsong 2023-11-22 16:47:36 -05:00 committed by GitHub
commit 5904f0593f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 10 deletions

View File

@ -53,12 +53,6 @@ function setPreference(key as string, value as string)
return set_user_setting("pref-" + key, value) return set_user_setting("pref-" + key, value)
end function 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) sub setServer(hostname as string)
m.top.server = hostname m.top.server = hostname
end sub end sub

View File

@ -11,6 +11,5 @@
<function name="setPreference" /> <function name="setPreference" />
<function name="loadFromRegistry" /> <function name="loadFromRegistry" />
<function name="saveToRegistry" /> <function name="saveToRegistry" />
<function name="setActive" />
</interface> </interface>
</component> </component>

View File

@ -12,9 +12,8 @@ function get_token(user as string, password as string)
userdata = CreateObject("roSGNode", "UserData") userdata = CreateObject("roSGNode", "UserData")
userdata.json = json userdata.json = json
userdata.callFunc("setActive")
userdata.callFunc("saveToRegistry") userdata.callFunc("saveToRegistry")
return userdata return userdata
end function end function
@ -163,8 +162,8 @@ function AuthenticateViaQuickConnect(secret)
userdata.json = jsonResponse userdata.json = jsonResponse
session.user.Update("id", jsonResponse.User.Id) session.user.Update("id", jsonResponse.User.Id)
session.user.Update("authToken", jsonResponse.AccessToken) session.user.Update("authToken", jsonResponse.AccessToken)
userdata.callFunc("setActive")
userdata.callFunc("saveToRegistry") userdata.callFunc("saveToRegistry")
return true return true
end if end if

View File

@ -183,6 +183,10 @@ namespace session
set_user_setting("username", tmpSession.user.name) set_user_setting("username", tmpSession.user.name)
end if end if
if m.global.session.user.settings["global.rememberme"]
set_setting("active_user", tmpSession.user.id)
end if
session.user.LoadUserPreferences() session.user.LoadUserPreferences()
end sub end sub