mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
logout google account when user sign out
This commit is contained in:
parent
aeecaa4e81
commit
b35096bcca
@ -118,3 +118,12 @@ self.OS or=
|
||||
else
|
||||
# startX :)
|
||||
_GUI.startAntOS d.result
|
||||
|
||||
cleanupHandlers: {}
|
||||
exit: ->
|
||||
#do clean up first
|
||||
f() for n, f of _OS.cleanupHandlers
|
||||
_API.handler.setting () ->
|
||||
_API.handler.logout()
|
||||
onexit: (n, f) ->
|
||||
self.OS.cleanupHandlers[n] = f unless self.OS.cleanupHandlers[n]
|
@ -334,7 +334,7 @@ self.OS.GUI =
|
||||
dataid: "sys-logout",
|
||||
iconclass: "fa fa-user-times"
|
||||
menu.onmenuselect = (d) ->
|
||||
return _API.handler.logout() if d.item.data.dataid is "sys-logout"
|
||||
return _OS.exit() if d.item.data.dataid is "sys-logout"
|
||||
return _GUI.toggleFullscreen() if d.item.data.dataid is "os-fullsize"
|
||||
_GUI.launch d.item.data.app unless d.item.data.dataid
|
||||
|
||||
|
@ -72,7 +72,6 @@ self.OS.API.handler =
|
||||
_API.post p, d, c, () ->
|
||||
alert "Resource not found: #{p}"
|
||||
logout: () ->
|
||||
_API.handler.setting () ->
|
||||
p = "#{_REST}/system/logout"
|
||||
_API.post p, {}, (d) ->
|
||||
_OS.boot()
|
||||
|
@ -43,7 +43,7 @@ class GoogleDriveHandler extends this.OS.API.VFS.BaseFileHandler
|
||||
_GUI.openDialog "YesNoDialog", (d) ->
|
||||
return _courrier.osinfo "User abort the authentification" unless d
|
||||
fn(gapi.auth2.getAuthInstance().isSignedIn.get())
|
||||
, "Authentification", { text: "Do you want to login to Google Drive ?" }
|
||||
, "Authentification", { text: "Would you like to login to Google Drive ?" }
|
||||
.catch (err) ->
|
||||
_API.loaded q, "FAIL"
|
||||
_courrier.oserror "VFS cannot init GAPI: #{err.error}", (_API.throwe "OS.VFS"), err
|
||||
@ -317,3 +317,20 @@ self.OS.API.onsearch "Google Drive", (t) ->
|
||||
file.detail = [{ text: file.path }]
|
||||
arr.push file
|
||||
return arr
|
||||
|
||||
self.OS.onexit "cleanUpGoogleDrive", () ->
|
||||
G_CACHE = { "gdv:///": { id: "root", mime: 'dir' } }
|
||||
return unless _OS.setting.VFS.gdrive and _API.libready _OS.setting.VFS.gdrive.apilink
|
||||
auth2 = gapi.auth2.getAuthInstance()
|
||||
return unless auth2
|
||||
if auth2.isSignedIn.get()
|
||||
el = $ '<iframe/>', {
|
||||
src: 'https://www.google.com/accounts/Logout',
|
||||
frameborder: 0,
|
||||
onload: () ->
|
||||
#console.log("disconnect")
|
||||
auth2.disconnect()
|
||||
#$(this).remove()
|
||||
}
|
||||
#($ "body").append(el)
|
||||
|
@ -16,7 +16,7 @@ class UserService extends this.OS.GUI.BaseService
|
||||
}
|
||||
]
|
||||
@onmenuselect = (d) ->
|
||||
return me._api.handler.logout() if d.item.data.dataid is "sys-logout"
|
||||
return window.OS.exit() if d.item.data.dataid is "sys-logout"
|
||||
me.notify "This feature is not implemented yet"
|
||||
awake: (e) ->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user