logout google account when user sign out

This commit is contained in:
Xuan Sang LE 2018-03-04 12:35:19 +01:00
parent aeecaa4e81
commit b35096bcca
5 changed files with 36 additions and 11 deletions

View File

@ -117,4 +117,13 @@ self.OS or=
_GUI.login()
else
# startX :)
_GUI.startAntOS d.result
_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]

View File

@ -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

View File

@ -72,12 +72,11 @@ 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()
, () ->
alert "Resource not found #{p}"
p = "#{_REST}/system/logout"
_API.post p, {}, (d) ->
_OS.boot()
, () ->
alert "Resource not found #{p}"
setting: (f) ->
p = "#{_REST}/system/settings"
_API.post p, _OS.setting, (d) ->

View File

@ -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
@ -316,4 +316,21 @@ self.OS.API.onsearch "Google Drive", (t) ->
file.complex = true
file.detail = [{ text: file.path }]
arr.push file
return arr
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)

View File

@ -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) ->