mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-10 15:08:28 +03:00
Add Gmail XAUTH support
This commit is contained in:
parent
08333610ce
commit
32ceafa37f
16 changed files with 359 additions and 138 deletions
|
|
@ -69,6 +69,12 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
isCached = pInt(data.Time) > microtime() - start;
|
||||
}
|
||||
|
||||
if (data && data.UpdateToken) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.setClientSideToken) {
|
||||
GlobalsData.__APP__.setClientSideToken(data.UpdateToken);
|
||||
}
|
||||
}
|
||||
|
||||
// backward capability
|
||||
let type = '';
|
||||
switch (true) {
|
||||
|
|
|
|||
|
|
@ -161,6 +161,12 @@ class AbstractAjaxRemote {
|
|||
cached = pInt(oData.Time) > new window.Date().getTime() - start;
|
||||
}
|
||||
|
||||
if (oData && oData.UpdateToken) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.setClientSideToken) {
|
||||
GlobalsData.__APP__.setClientSideToken(oData.UpdateToken);
|
||||
}
|
||||
}
|
||||
|
||||
if (action && this.oRequests[action]) {
|
||||
if (this.oRequests[action].__aborted) {
|
||||
sType = 'abort';
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class SocialAdminSettings {
|
|||
constructor() {
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableAuthGmail = SocialStore.google.capa.authGmail;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
|
|
@ -89,6 +89,7 @@ class SocialAdminSettings {
|
|||
|
||||
this.googleEnable.subscribe(Remote.saveAdminConfigHelper('GoogleEnable', boolToAjax));
|
||||
this.googleEnableAuth.subscribe(Remote.saveAdminConfigHelper('GoogleEnableAuth', boolToAjax));
|
||||
this.googleEnableAuthGmail.subscribe(Remote.saveAdminConfigHelper('GoogleEnableAuthGmail', boolToAjax));
|
||||
this.googleEnableDrive.subscribe(Remote.saveAdminConfigHelper('GoogleEnableDrive', boolToAjax));
|
||||
this.googleEnablePreview.subscribe(Remote.saveAdminConfigHelper('GoogleEnablePreview', boolToAjax));
|
||||
this.googleClientID.subscribe(Remote.saveAdminConfigHelper('GoogleClientID', trim, f5));
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class SocialUserSettings {
|
|||
constructor() {
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableAuthGmail = SocialStore.google.capa.authGmail;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@ class SocialStore {
|
|||
|
||||
this.google.capa = {};
|
||||
this.google.capa.auth = ko.observable(false);
|
||||
this.google.capa.authFast = ko.observable(false);
|
||||
this.google.capa.authGmail = ko.observable(false);
|
||||
this.google.capa.drive = ko.observable(false);
|
||||
this.google.capa.preview = ko.observable(false);
|
||||
|
||||
this.google.require = {};
|
||||
this.google.require.clientSettings = ko.computed(
|
||||
() => this.google.enabled() && (this.google.capa.auth() || this.google.capa.drive())
|
||||
() =>
|
||||
this.google.enabled() && (this.google.capa.auth() || this.google.capa.authGmail() || this.google.capa.drive())
|
||||
);
|
||||
|
||||
this.google.require.apiKeySettings = ko.computed(() => this.google.enabled() && this.google.capa.drive());
|
||||
|
|
@ -66,7 +67,7 @@ class SocialStore {
|
|||
this.google.apiKey(Settings.settingsGet('GoogleApiKey'));
|
||||
|
||||
this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
|
||||
this.google.capa.authFast(!!Settings.settingsGet('AllowGoogleSocialAuthFast'));
|
||||
this.google.capa.authGmail(!!Settings.settingsGet('AllowGoogleSocialAuthGmail'));
|
||||
this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
|
||||
this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class LoginUserView extends AbstractViewNext {
|
|||
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
this.googleFastLoginEnabled = ko.observable(false);
|
||||
this.googleGmailLoginEnabled = ko.observable(false);
|
||||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.socialLoginEnabled = ko.computed(() => {
|
||||
|
|
@ -175,8 +175,8 @@ class LoginUserView extends AbstractViewNext {
|
|||
return true;
|
||||
}
|
||||
|
||||
@command((self) => !self.submitRequest() && self.googleFastLoginEnabled())
|
||||
googleFastCommand() {
|
||||
@command((self) => !self.submitRequest() && self.googleGmailLoginEnabled())
|
||||
googleGmailCommand() {
|
||||
window.open(socialGoogle(true), 'Google', this.windowOpenFeatures(550));
|
||||
return true;
|
||||
}
|
||||
|
|
@ -344,8 +344,8 @@ class LoginUserView extends AbstractViewNext {
|
|||
this.googleLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth')
|
||||
);
|
||||
this.googleFastLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthFast')
|
||||
this.googleGmailLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthGmail')
|
||||
);
|
||||
|
||||
switch (signMe) {
|
||||
|
|
@ -375,7 +375,7 @@ class LoginUserView extends AbstractViewNext {
|
|||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled()) {
|
||||
if (this.googleLoginEnabled() || this.googleGmailLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue