فهرست منبع

Merge pull request #6338 from nextcloud/legacyLoginFlow

Removed legacy login
Andy Scherzinger 4 سال پیش
والد
کامیت
5288548e70

+ 1 - 1
scripts/analysis/findbugs-results.txt

@@ -1 +1 @@
-345
+340

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 57 - 553
src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java


+ 1 - 1
src/main/java/com/owncloud/android/ui/activity/EditorWebView.java

@@ -90,7 +90,7 @@ public abstract class EditorWebView extends ExternalSiteWebView {
                 if (getWebview().getVisibility() != View.VISIBLE) {
                     Snackbar snackbar = DisplayUtils.createSnackbar(findViewById(android.R.id.content),
                                                                     R.string.timeout_richDocuments, Snackbar.LENGTH_INDEFINITE)
-                        .setAction(R.string.fallback_weblogin_back, v -> closeView());
+                        .setAction(R.string.common_back, v -> closeView());
 
                     ThemeUtils.colorSnackbar(getApplicationContext(), snackbar);
                     setLoadingSnackbar(snackbar);

+ 0 - 164
src/main/java/com/owncloud/android/ui/dialog/CredentialsDialogFragment.java

@@ -1,164 +0,0 @@
-/**
- *   ownCloud Android client application
- *
- *   Copyright (C) 2015 ownCloud Inc.
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2,
- *   as published by the Free Software Foundation.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package com.owncloud.android.ui.dialog;
-
-import android.app.Dialog;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.text.InputType;
-import android.view.Window;
-import android.view.WindowManager.LayoutParams;
-import android.webkit.HttpAuthHandler;
-import android.webkit.WebView;
-import android.widget.EditText;
-import android.widget.LinearLayout;
-
-import com.owncloud.android.R;
-import com.owncloud.android.authentication.AuthenticatorActivity;
-
-import androidx.appcompat.app.AlertDialog;
-import androidx.appcompat.app.AlertDialog.Builder;
-import androidx.fragment.app.DialogFragment;
-
-
-
-/**
- *  Dialog to input authentication credentials
- *
- */
-public class CredentialsDialogFragment extends DialogFragment
-    implements DialogInterface.OnClickListener {
-
-    private WebView mWebView;
-    private HttpAuthHandler mHandler;
-
-    private EditText mUsernameET;
-    private EditText mPasswordET;
-
-    private String mUsernameStr;
-    private String mPasswordStr;
-
-
-    /**
-     * Public factory method to create new CredentialsDialogFragment instances.
-     * @param webView       WebView that is being loaded
-     * @param handler       HttpAuthHandler
-     * @return              Dialog ready to show
-     */
-    public static CredentialsDialogFragment newInstanceForCredentials(WebView webView,
-                                                                      HttpAuthHandler handler) {
-        if (handler == null) {
-            throw new IllegalArgumentException("Trying to create instance with parameter handler" +
-                    " == null");
-        }
-        CredentialsDialogFragment frag = new CredentialsDialogFragment();
-        frag.mHandler = handler;
-        frag.mWebView = webView;
-        return frag;
-    }
-
-
-    @Override
-    public Dialog onCreateDialog(Bundle savedInstanceState) {
-
-        // Create field for username
-        mUsernameET = new EditText(getActivity());
-        mUsernameET.setHint(getActivity().getText(R.string.auth_username));
-
-        // Create field for password
-        mPasswordET = new EditText(getActivity());
-        mPasswordET.setHint(getActivity().getText(R.string.auth_password));
-        mPasswordET.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
-
-        // Prepare LinearLayout for dialog
-        LinearLayout ll = new LinearLayout(getActivity());
-        ll.setOrientation(LinearLayout.VERTICAL);
-        ll.addView(mUsernameET);
-        ll.addView(mPasswordET);
-
-        ll.requestFocus();
-
-        setRetainInstance(true);
-
-        Builder authDialog = new AlertDialog
-                .Builder(getActivity())
-                .setTitle(getActivity().getText(R.string.saml_authentication_required_text))
-                .setView(ll)
-                .setCancelable(false)
-                .setPositiveButton(R.string.common_ok, this)
-                .setNegativeButton(R.string.common_cancel, this);
-
-        Dialog d = authDialog.create();
-
-        Window window = d.getWindow();
-        if (window != null) {
-            window.setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
-        }
-
-        return d;
-    }
-
-
-    @Override
-    public void onPause() {
-        super.onPause();
-        // Due to the use of setRetainInstance(true) for keep the dialog over the rest of dialogs,
-        // we need to save the inputs text for being injected in onResume()
-        mUsernameStr = mUsernameET.getText().toString();
-        mPasswordStr = mPasswordET.getText().toString();
-    }
-
-
-    @Override
-    public void onResume() {
-        super.onResume();
-        mUsernameET.setText(mUsernameStr);
-        mPasswordET.setText(mPasswordStr);
-    }
-
-
-    @Override
-    public void onClick(DialogInterface dialog, int which) {
-        if (which == AlertDialog.BUTTON_POSITIVE) {
-
-            String username = mUsernameET.getText().toString();
-            String password = mPasswordET.getText().toString();
-
-            // Proceed with the authentication
-            mHandler.proceed(username, password);
-
-        } else if (which == AlertDialog.BUTTON_NEGATIVE) {
-            mWebView.stopLoading();
-            ((AuthenticatorActivity)getActivity()).doNegativeAuthenticationDialogClick();
-        }
-
-        dialog.dismiss();
-    }
-
-
-    @Override
-    public void onDestroyView() {
-      if (getDialog() != null && getRetainInstance()) {
-          getDialog().setDismissMessage(null);
-      }
-      super.onDestroyView();
-    }
-
-}

+ 1 - 74
src/main/res/layout-land/account_setup.xml

@@ -52,29 +52,6 @@
             android:orientation="vertical"
             android:padding="@dimen/standard_half_padding">
 
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/centered_refresh_button"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginBottom="@dimen/alternate_margin"
-                android:contentDescription="@string/auth_check_server"
-                android:text="@string/auth_check_server"
-                android:theme="@style/Button"
-                android:visibility="gone"
-                app:cornerRadius="@dimen/button_corner_radius" />
-
-            <TextView
-                android:id="@+id/instructions_message"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="fill_horizontal"
-                android:layout_marginBottom="@dimen/alternate_margin"
-                android:contentDescription="@string/auth_expired_basic_auth_toast"
-                android:text="@string/auth_expired_basic_auth_toast"
-                android:textColor="@color/login_text_color"
-                android:visibility="gone" />
-
             <FrameLayout
                 android:id="@+id/host_url_frame"
                 android:layout_width="match_parent"
@@ -128,18 +105,6 @@
                     android:src="@drawable/arrow_right"
                     android:tint="@color/login_btn_tint" />
 
-                <ImageButton
-                    android:id="@+id/embedded_refresh_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical|end"
-                    android:layout_marginEnd="@dimen/alternate_half_margin"
-                    android:background="@android:color/transparent"
-                    android:contentDescription="@string/auth_refresh_button"
-                    android:padding="@dimen/zero"
-                    android:scaleType="fitCenter"
-                    android:src="@drawable/ic_action_refresh"
-                    android:visibility="gone" />
             </FrameLayout>
 
             <TextView
@@ -153,32 +118,8 @@
                 android:gravity="center_vertical"
                 android:minHeight="@dimen/display_text_min_height"
                 android:text="@string/auth_testing_connection"
-                android:textColor="@color/login_text_color" />
-
-            <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/account_username"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:autofillHints="username"
-                android:ems="10"
-                android:hint="@string/auth_username"
-                android:inputType="textNoSuggestions"
                 android:textColor="@color/login_text_color"
-                android:textColorHint="@color/login_text_hint_color"
-                android:visibility="gone" />
-
-            <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/account_password"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:autofillHints="password"
-                android:drawablePadding="@dimen/alternate_half_padding"
-                android:ems="10"
-                android:hint="@string/auth_password"
-                android:inputType="textPassword"
-                android:textColor="@color/login_text_color"
-                android:textColorHint="@color/login_text_hint_color"
-                android:visibility="gone" />
+                android:visibility="invisible" />
 
             <TextView
                 android:id="@+id/auth_status_text"
@@ -199,20 +140,6 @@
                 android:contentDescription="@string/scanQR_description"
                 android:src="@drawable/qrcode_scan" />
 
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/button_ok"
-                style="@style/Button.Login"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:contentDescription="@string/setup_btn_connect"
-                android:enabled="false"
-                android:padding="@dimen/standard_padding"
-                android:text="@string/setup_btn_connect"
-                android:theme="@style/Button.Login"
-                android:visibility="gone"
-                app:cornerRadius="@dimen/button_corner_radius" />
-
         </LinearLayout>
 
     </ScrollView>

+ 1 - 77
src/main/res/layout/account_setup.xml

@@ -51,31 +51,6 @@
             android:orientation="vertical"
             android:padding="@dimen/standard_half_padding">
 
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/centered_refresh_button"
-                style="@style/Button.Primary"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginBottom="@dimen/alternate_margin"
-                android:contentDescription="@string/auth_check_server"
-                android:text="@string/auth_check_server"
-                android:theme="@style/Button"
-                android:visibility="gone"
-                app:cornerRadius="@dimen/button_corner_radius" />
-
-            <TextView
-                android:id="@+id/instructions_message"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="fill_horizontal"
-                android:layout_marginBottom="@dimen/alternate_margin"
-                android:contentDescription="@string/auth_expired_basic_auth_toast"
-                android:text="@string/auth_expired_basic_auth_toast"
-                android:textColor="@color/login_text_color"
-                android:visibility="gone" />
-
-
             <FrameLayout
                 android:id="@+id/host_url_frame"
                 android:layout_width="match_parent"
@@ -129,18 +104,6 @@
                     android:src="@drawable/arrow_right"
                     android:tint="@color/login_text_color" />
 
-                <ImageButton
-                    android:id="@+id/embedded_refresh_button"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center_vertical|end"
-                    android:layout_marginEnd="@dimen/alternate_half_padding"
-                    android:background="@android:color/transparent"
-                    android:contentDescription="@string/auth_refresh_button"
-                    android:padding="@dimen/zero"
-                    android:scaleType="fitCenter"
-                    android:src="@drawable/ic_action_refresh"
-                    android:visibility="gone" />
             </FrameLayout>
 
             <TextView
@@ -154,38 +117,13 @@
                 android:gravity="center_vertical"
                 android:minHeight="@dimen/display_text_min_height"
                 android:text="@string/auth_testing_connection"
-                android:textColor="@color/login_text_color" />
-
-            <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/account_username"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:autofillHints="username"
-                android:ems="10"
-                android:hint="@string/auth_username"
-                android:inputType="textNoSuggestions"
-                android:textColor="@color/login_text_color"
-                android:textColorHint="@color/login_text_hint_color"
-                android:visibility="gone" />
-
-            <com.google.android.material.textfield.TextInputEditText
-                android:id="@+id/account_password"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:autofillHints="password"
-                android:drawablePadding="@dimen/alternate_half_padding"
-                android:ems="10"
-                android:hint="@string/auth_password"
-                android:inputType="textPassword"
                 android:textColor="@color/login_text_color"
-                android:textColorHint="@color/login_text_hint_color"
-                android:visibility="gone" />
+                android:visibility="invisible" />
 
             <TextView
                 android:id="@+id/auth_status_text"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_marginBottom="@dimen/alternate_margin"
                 android:contentDescription="@string/auth_unauthorized"
                 app:drawableStartCompat="@android:drawable/stat_notify_sync"
                 android:drawablePadding="@dimen/alternate_half_padding"
@@ -202,22 +140,8 @@
                 android:src="@drawable/qrcode_scan"
                 android:theme="@style/Button.Login" />
 
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/button_ok"
-                style="@style/Button.Login"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:contentDescription="@string/setup_btn_connect"
-                android:enabled="false"
-                android:padding="@dimen/standard_padding"
-                android:text="@string/setup_btn_connect"
-                android:theme="@style/Button.Login"
-                android:visibility="gone"
-                app:cornerRadius="@dimen/button_corner_radius" />
         </LinearLayout>
 
-
     </LinearLayout>
 
 </ScrollView>

+ 0 - 1
src/main/res/values/colors.xml

@@ -82,7 +82,6 @@
     <!-- Excluded from future app dark theme -->
     <color name="themed_fg">#FFFFFF</color>
     <color name="themed_fg_inverse">#000000</color>
-    <color name="themed_bg">#222222</color>
 
     <!-- App bar -->
     <color name="appbar">@android:color/white</color>

+ 0 - 2
src/main/res/values/setup.xml

@@ -21,7 +21,6 @@
     <string name="only_office_user_agent">Mozilla/5.0 (Android %1$s) Mobile Nextcloud-android/%2$s</string>
 
     <!-- URLs and flags related -->
-    <string name="server_url"></string>
     <bool name="show_server_url_input">true</bool>
     <bool name="show_provider_or_own_installation">true</bool>
     <string name="provider_registration_server">https://www.nextcloud.com/register</string>
@@ -109,7 +108,6 @@
     <!-- url for webview login, with the protocol prefix and with full url (normally /index.php/login/flow)
     If set, will replace all other login methods available -->
     <string name="webview_login_url" translatable="false"></string>
-    <bool name="show_old_login">false</bool>
 
     <!-- Files becomes Home -->
     <bool name="use_home">false</bool>

+ 1 - 11
src/main/res/values/strings.xml

@@ -66,12 +66,10 @@
     <string name="recommend_text">I want to invite you to use %1$s on your device.\nDownload here: %2$s</string>
     <string name="recommend_urls">%1$s or %2$s</string>
 
-    <string name="auth_check_server">Check server</string>
     <string name="auth_host_url">Server address https://…</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>
     <string name="sync_string_files">Files</string>
-    <string name="setup_btn_connect">Connect</string>
     <string name="uploader_btn_upload_text">Upload</string>
     <string name="uploader_btn_alternative_text">Choose</string>
     <string name="uploader_top_message">Choose upload folder</string>
@@ -257,14 +255,10 @@
     <string name="auth_unauthorized">Wrong username or password</string>
     <string name="auth_oauth_error">Unsuccessful authorization</string>
     <string name="auth_oauth_error_access_denied">Access denied by authorization server</string>
-    <string name="auth_wtf_reenter_URL">Unexpected state, please enter the server address again.</string>
-    <string name="auth_expired_basic_auth_toast">Please enter the current password</string>
     <string name="auth_unsupported_multiaccount">%1$s does not support multiple accounts</string>
     <string name="auth_fail_get_user_name">Your server is not returning a correct user ID, please contact an admin.</string>
-    <string name="auth_can_not_auth_against_server">Cannot authenticate to this server</string>
     <string name="auth_account_does_not_exist">The account is not added on this device yet</string>
     <string name="auth_access_failed">Access failed: %1$s</string>
-    <string name="auth_illegal_login_used">Illegal login data URL used</string>
 
     <string name="favorite">Add to favorites</string>
     <string name="unset_favorite">Remove from favourites</string>
@@ -410,8 +404,6 @@
     <string name="log_send_no_mail_app">No app for sending logs found. Please install an e-mail client.</string>
     <string name="log_send_mail_subject">%1$s Android app logs</string>
 
-    <string name="saml_authentication_required_text">Password required</string>
-    <string name="saml_authentication_wrong_pass">Wrong password</string>
     <string name="actionbar_move">Move</string>
     <string name="actionbar_copy">Copy</string>
     <string name="file_list_empty_moving">Nothing in here. You can add a folder.</string>
@@ -437,7 +429,6 @@
     <string name="subject_user_shared_with_you">%1$s shared \"%2$s\" with you</string>
     <string name="subject_shared_with_you">\"%1$s\" has been shared with you</string>
 
-    <string name="auth_refresh_button">Refresh connection</string>
     <string name="auth_host_address">Server address</string>
     <string name="common_error_out_memory">Not enough memory</string>
 
@@ -637,8 +628,6 @@
     <string name="test_server_button">Test server connection</string>
     <string name="info_separator" translatable="false">&#160;&#x2022;</string>
     <string name="resharing_is_not_allowed">Resharing is not allowed</string>
-    <string name="fallback_weblogin_back">Back</string>
-    <string name="fallback_weblogin_text">Revert to old login method</string>
 
     <string name="foreground_service_upload">Uploading files…</string>
     <string name="foreground_service_download">Downloading files…</string>
@@ -937,4 +926,5 @@
     <string name="thumbnail_for_existing_file_description">Thumbnail for existing file</string>
     <string name="invalid_url">Invalid URL</string>
     <string name="conflict_dialog_error">Error creating conflict dialog!</string>
+    <string name="qr_could_not_be_read">QR Code could not be read!</string>
 </resources>

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است