1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Desktop: Change Joplin Cloud login process to allow MFA via browser (#9445)

Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
This commit is contained in:
pedr
2024-03-09 07:35:54 -03:00
committed by GitHub
parent 75cb639ed2
commit 4d8fcff6d5
15 changed files with 347 additions and 124 deletions

View File

@@ -6,6 +6,7 @@ import { Env } from './models/Setting';
import Logger from '@joplin/utils/Logger';
import personalizedUserContentBaseUrl from './services/joplinServer/personalizedUserContentBaseUrl';
import { getHttpStatusMessage } from './net-utils';
import { getApplicationInformation } from './services/joplinCloudUtils';
const { stringify } = require('query-string');
const logger = Logger.create('JoplinServerApi');
@@ -63,13 +64,27 @@ export default class JoplinServerApi {
return personalizedUserContentBaseUrl(userId, this.baseUrl(), this.options_.userContentBaseUrl());
}
private async getClientInfo() {
const { platform, type } = await getApplicationInformation();
const clientInfo = {
platform,
type,
version: shim.appVersion(),
};
return clientInfo;
}
private async session() {
if (this.session_) return this.session_;
const clientInfo = await this.getClientInfo();
try {
this.session_ = await this.exec_('POST', 'api/sessions', null, {
email: this.options_.username(),
password: this.options_.password(),
...clientInfo,
});
return this.session_;