mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +03:00
Small improvements for #1645
This commit is contained in:
parent
7f7ee97106
commit
139d3e6651
2 changed files with 12 additions and 5 deletions
|
|
@ -1,10 +1,10 @@
|
||||||
(rl => {
|
(rl => {
|
||||||
const client_id = rl.pluginSettingsGet('login-gmail', 'client_id'),
|
const client_id = rl.pluginSettingsGet('login-o365', 'client_id'),
|
||||||
login = () => {
|
login = () => {
|
||||||
document.location = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?' + (new URLSearchParams({
|
document.location = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize?' + (new URLSearchParams({
|
||||||
response_type: 'code',
|
response_type: 'code',
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
redirect_uri: document.location.href + '?LoginGMail',
|
redirect_uri: document.location.href + '?LoginO365',
|
||||||
scope: [
|
scope: [
|
||||||
// Associate personal info
|
// Associate personal info
|
||||||
'openid',
|
'openid',
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
'https://outlook.office.com/IMAP.AccessAsUser.All'
|
'https://outlook.office.com/IMAP.AccessAsUser.All'
|
||||||
*/
|
*/
|
||||||
].join(' '),
|
].join(' '),
|
||||||
state: 'gmail', // + rl.settings.app('token') + localStorage.getItem('smctoken')
|
state: 'o365', // + rl.settings.app('token') + localStorage.getItem('smctoken')
|
||||||
// Force authorize screen, so we always get a refresh_token
|
// Force authorize screen, so we always get a refresh_token
|
||||||
access_type: 'offline',
|
access_type: 'offline',
|
||||||
prompt: 'consent'
|
prompt: 'consent'
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
if (client_id) {
|
if (client_id) {
|
||||||
addEventListener('sm-user-login', e => {
|
addEventListener('sm-user-login', e => {
|
||||||
if (event.detail.get('Email').includes('@gmail.com')) {
|
if (event.detail.get('Email').includes('@hotmail.com')) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
login();
|
login();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
* I'm not going to pay, so feel free to fix this code yourself.
|
* I'm not going to pay, so feel free to fix this code yourself.
|
||||||
* https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth
|
* https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth
|
||||||
* https://answers.microsoft.com/en-us/msoffice/forum/all/configuration-for-imap-pop-and-smtp-with-oauth-in/3db47d43-25ac-4e0b-b957-22585e6caf15
|
* https://answers.microsoft.com/en-us/msoffice/forum/all/configuration-for-imap-pop-and-smtp-with-oauth-in/3db47d43-25ac-4e0b-b957-22585e6caf15
|
||||||
|
*
|
||||||
|
* https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/RegisteredApps
|
||||||
|
*
|
||||||
|
* redirect_uri=https://{DOMAIN}/?LoginO365
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use RainLoop\Model\MainAccount;
|
use RainLoop\Model\MainAccount;
|
||||||
|
|
@ -153,7 +157,10 @@ class LoginO365Plugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\RainLoop\Plugins\Property::NewInstance('client_secret')
|
\RainLoop\Plugins\Property::NewInstance('client_secret')
|
||||||
->SetLabel('Client Secret')
|
->SetLabel('Client Secret')
|
||||||
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING)
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING)
|
||||||
->SetEncrypted()
|
->SetEncrypted(),
|
||||||
|
\RainLoop\Plugins\Property::NewInstance('tenant_id')
|
||||||
|
->SetLabel('Tenant ID')
|
||||||
|
->SetType(\RainLoop\Enumerations\PluginPropertyType::STRING)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue