mirror of https://github.com/M66B/FairEmail.git
Revert Tenant ID
This commit is contained in:
parent
03dfae3741
commit
59f78834b6
|
@ -108,7 +108,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
private TextView tvPrivacy;
|
||||
private EditText etName;
|
||||
private EditText etEmail;
|
||||
private EditText etTenant;
|
||||
private CheckBox cbUpdate;
|
||||
private Button btnOAuth;
|
||||
private ContentLoadingProgressBar pbOAuth;
|
||||
|
@ -121,7 +120,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
private Button btnSupport;
|
||||
private Button btnHelp;
|
||||
|
||||
private Group grpTenant;
|
||||
private Group grpError;
|
||||
|
||||
private static final int MAILRU_TIMEOUT = 20 * 1000; // milliseconds
|
||||
|
@ -155,7 +153,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
tvPrivacy = view.findViewById(R.id.tvPrivacy);
|
||||
etName = view.findViewById(R.id.etName);
|
||||
etEmail = view.findViewById(R.id.etEmail);
|
||||
etTenant = view.findViewById(R.id.etTenant);
|
||||
cbUpdate = view.findViewById(R.id.cbUpdate);
|
||||
btnOAuth = view.findViewById(R.id.btnOAuth);
|
||||
pbOAuth = view.findViewById(R.id.pbOAuth);
|
||||
|
@ -168,7 +165,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
btnSupport = view.findViewById(R.id.btnSupport);
|
||||
btnHelp = view.findViewById(R.id.btnHelp);
|
||||
|
||||
grpTenant = view.findViewById(R.id.grpTenant);
|
||||
grpError = view.findViewById(R.id.grpError);
|
||||
|
||||
// Wire controls
|
||||
|
@ -212,7 +208,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
tvTitle.setText(getString(R.string.title_setup_oauth_rationale, name));
|
||||
etName.setVisibility(askAccount ? View.VISIBLE : View.GONE);
|
||||
etEmail.setVisibility(askAccount ? View.VISIBLE : View.GONE);
|
||||
grpTenant.setVisibility(isOutlook(id) ? View.VISIBLE : View.GONE);
|
||||
pbOAuth.setVisibility(View.GONE);
|
||||
tvConfiguring.setVisibility(View.GONE);
|
||||
tvGmailHint.setVisibility("gmail".equals(id) ? View.VISIBLE : View.GONE);
|
||||
|
@ -220,7 +215,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
|
||||
etName.setText(personal);
|
||||
etEmail.setText(address);
|
||||
etTenant.setText(null);
|
||||
cbUpdate.setChecked(update);
|
||||
|
||||
return view;
|
||||
|
@ -269,12 +263,10 @@ public class FragmentOAuth extends FragmentBase {
|
|||
|
||||
etName.clearFocus();
|
||||
etEmail.clearFocus();
|
||||
etTenant.clearFocus();
|
||||
Helper.hideKeyboard(view);
|
||||
|
||||
etName.setEnabled(false);
|
||||
etEmail.setEnabled(false);
|
||||
etTenant.setEnabled(false);
|
||||
cbUpdate.setEnabled(false);
|
||||
btnOAuth.setEnabled(false);
|
||||
pbOAuth.setVisibility(View.VISIBLE);
|
||||
|
@ -344,19 +336,9 @@ public class FragmentOAuth extends FragmentBase {
|
|||
|
||||
AuthorizationService authService = new AuthorizationService(context, appAuthConfig);
|
||||
|
||||
String authorizationEndpoint = provider.oauth.authorizationEndpoint;
|
||||
String tokenEndpoint = provider.oauth.tokenEndpoint;
|
||||
String tenant = etTenant.getText().toString().trim();
|
||||
|
||||
if (TextUtils.isEmpty(tenant))
|
||||
tenant = "common";
|
||||
|
||||
authorizationEndpoint = authorizationEndpoint.replace("{tenant}", tenant);
|
||||
tokenEndpoint = tokenEndpoint.replace("{tenant}", tenant);
|
||||
|
||||
AuthorizationServiceConfiguration serviceConfig = new AuthorizationServiceConfiguration(
|
||||
Uri.parse(authorizationEndpoint),
|
||||
Uri.parse(tokenEndpoint));
|
||||
Uri.parse(provider.oauth.authorizationEndpoint),
|
||||
Uri.parse(provider.oauth.tokenEndpoint));
|
||||
|
||||
AuthState authState = new AuthState(serviceConfig);
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
@ -402,8 +384,10 @@ public class FragmentOAuth extends FragmentBase {
|
|||
authRequestBuilder.setPrompt("consent");
|
||||
|
||||
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
|
||||
if (isOutlook(provider.id))
|
||||
if ("office365".equals(provider.id))
|
||||
authRequestBuilder.setPrompt("select_account");
|
||||
if ("outlook".equals(provider.id))
|
||||
authRequestBuilder.setPrompt("consent");
|
||||
|
||||
AuthorizationRequest authRequest = authRequestBuilder.build();
|
||||
|
||||
|
@ -429,7 +413,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
try {
|
||||
etName.setEnabled(true);
|
||||
etEmail.setEnabled(true);
|
||||
etTenant.setEnabled(true);
|
||||
cbUpdate.setEnabled(true);
|
||||
|
||||
AuthorizationResponse auth = AuthorizationResponse.fromIntent(data);
|
||||
|
@ -467,7 +450,7 @@ public class FragmentOAuth extends FragmentBase {
|
|||
.setAdditionalParameters(Collections.<String, String>emptyMap())
|
||||
.setNonce(auth.request.nonce);
|
||||
|
||||
if (isOutlook(provider.id))
|
||||
if ("office365".equals(provider.id) || "outlook".equals(provider.id))
|
||||
builder.setScope(TextUtils.join(" ", provider.oauth.scopes));
|
||||
|
||||
TokenRequest request = builder.build();
|
||||
|
@ -938,7 +921,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
private void onHandleCancel() {
|
||||
etName.setEnabled(true);
|
||||
etEmail.setEnabled(true);
|
||||
etTenant.setEnabled(true);
|
||||
cbUpdate.setEnabled(true);
|
||||
btnOAuth.setEnabled(true);
|
||||
pbOAuth.setVisibility(View.GONE);
|
||||
|
@ -960,7 +942,7 @@ public class FragmentOAuth extends FragmentBase {
|
|||
if ("gmail".equals(id))
|
||||
tvGmailDraftsHint.setVisibility(View.VISIBLE);
|
||||
|
||||
if (isOutlook(id)) {
|
||||
if ("office365".equals(id) || "outlook".equals(id)) {
|
||||
if (ex instanceof AuthenticationFailedException)
|
||||
tvOfficeAuthHint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -977,7 +959,6 @@ public class FragmentOAuth extends FragmentBase {
|
|||
|
||||
etName.setEnabled(true);
|
||||
etEmail.setEnabled(true);
|
||||
etTenant.setEnabled(true);
|
||||
cbUpdate.setEnabled(true);
|
||||
btnOAuth.setEnabled(true);
|
||||
pbOAuth.setVisibility(View.GONE);
|
||||
|
@ -998,8 +979,4 @@ public class FragmentOAuth extends FragmentBase {
|
|||
tvGmailDraftsHint.setVisibility(View.GONE);
|
||||
tvOfficeAuthHint.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private static boolean isOutlook(String id) {
|
||||
return ("office365".equals(id) || "outlook".equals(id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,29 +67,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etName" />
|
||||
|
||||
<eu.faircode.email.EditTextPlain
|
||||
android:id="@+id/etTenant"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="emailAddress"
|
||||
android:hint="@string/title_identity_tenant"
|
||||
android:imeOptions="actionNext"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etEmail" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvTenantHint"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_identity_tenant_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etTenant" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbUpdate"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -98,7 +75,7 @@
|
|||
android:text="@string/title_setup_oauth_update"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvTenantHint" />
|
||||
app:layout_constraintTop_toBottomOf="@id/etEmail" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOAuth"
|
||||
|
@ -219,12 +196,6 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOfficeAuthHint" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpTenant"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="etTenant,tvTenantHint" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpError"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -812,8 +812,6 @@
|
|||
<string name="title_select">Select …</string>
|
||||
<string name="title_identity_name">Your name</string>
|
||||
<string name="title_identity_email">Your email address</string>
|
||||
<string name="title_identity_tenant" translatable="false">Tenant ID</string>
|
||||
<string name="title_identity_tenant_hint">This field should be empty in most cases</string>
|
||||
<string name="title_identity_color_hint">Identity colors take precedence over folder and account colors</string>
|
||||
<string name="title_advanced_sender">Allow editing sender address</string>
|
||||
<string name="title_advanced_sender_name">Use name when sender address has been edited</string>
|
||||
|
|
|
@ -97,14 +97,14 @@
|
|||
starttls="true" />
|
||||
<oauth
|
||||
askAccount="true"
|
||||
authorizationEndpoint="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize"
|
||||
authorizationEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
|
||||
clientId="3514cf2c-e7a3-45a2-80d4-6a3c3498eca0"
|
||||
clientSecret="r=o4@SlzU:MA6MlXM6mPG[44i4gYPq[@"
|
||||
enabled="true"
|
||||
privacy="https://privacy.microsoft.com/privacystatement"
|
||||
redirectUri="https://oauth.faircode.eu/"
|
||||
scopes="profile,openid,email,offline_access,https://outlook.office.com/IMAP.AccessAsUser.All,https://outlook.office.com/SMTP.Send"
|
||||
tokenEndpoint="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" />
|
||||
tokenEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/token" />
|
||||
<!-- https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth -->
|
||||
</provider>
|
||||
<provider
|
||||
|
@ -125,14 +125,14 @@
|
|||
starttls="true" />
|
||||
<oauth
|
||||
askAccount="true"
|
||||
authorizationEndpoint="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize"
|
||||
authorizationEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
|
||||
clientId="17e57eca-a59b-4574-ac91-b343004898a6"
|
||||
clientSecret="k847Q~ZKtIBNp~ls_riKEbFDsvOQEdUA.YDNt"
|
||||
enabled="false"
|
||||
privacy="https://privacy.microsoft.com/privacystatement"
|
||||
redirectUri="https://oauth.faircode.eu/"
|
||||
scopes="openid,email,offline_access,https://outlook.office.com/IMAP.AccessAsUser.All,https://outlook.office.com/SMTP.Send"
|
||||
tokenEndpoint="https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token" />
|
||||
tokenEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/token" />
|
||||
<!-- https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth -->
|
||||
</provider>
|
||||
<!-- needs subscription -->
|
||||
|
|
Loading…
Reference in New Issue