فهرست منبع

Merge pull request #202 from owncloud/modify_password

Modify password of an existing account with long press in the list of accounts
masensio 11 سال پیش
والد
کامیت
af7331d31c

+ 27 - 9
res/layout-land/account_setup.xml

@@ -55,17 +55,35 @@
 			    android:orientation="vertical"
 			    android:orientation="vertical"
 			    android:padding="8dp" >
 			    android:padding="8dp" >
 		
 		
-				<EditText
-					android:id="@+id/hostUrlInput"
+			    <FrameLayout 
 					android:layout_width="match_parent"
 					android:layout_width="match_parent"
 					android:layout_height="wrap_content"
 					android:layout_height="wrap_content"
-					android:ems="10"
-					android:hint="@string/auth_host_url"
-					android:inputType="textUri"
-					android:drawablePadding="5dp"
-					>
-					<requestFocus />
-				</EditText>
+			        >
+					<EditText
+						android:id="@+id/hostUrlInput"
+						android:layout_width="match_parent"
+						android:layout_height="wrap_content"
+						android:hint="@string/auth_host_url"
+						android:inputType="textUri"
+						android:drawablePadding="5dp"
+						android:paddingRight="55dp"
+						>
+						<requestFocus />
+					</EditText>
+					<ImageButton
+					    android:id="@+id/refeshButton"
+					    android:layout_width="48dp"
+					    android:layout_height="48dp"
+					    android:layout_gravity="center_vertical|right"
+					    android:layout_marginRight="5dp"
+					    android:padding="0dp"
+					    android:scaleType="fitCenter"
+					    android:src="@drawable/ic_action_refresh_black"
+            			android:onClick="onRefreshClick"
+					    android:visibility="gone"
+						android:background="@android:color/transparent"
+					    />
+				</FrameLayout>
 		
 		
 				<TextView
 				<TextView
 					android:id="@+id/server_status_text"
 					android:id="@+id/server_status_text"

+ 29 - 11
res/layout/account_setup.xml

@@ -40,19 +40,37 @@
             android:layout_marginTop="10dp"
             android:layout_marginTop="10dp"
             android:src="@drawable/logo" />
             android:src="@drawable/logo" />
 
 
-		<EditText
-			android:id="@+id/hostUrlInput"
+	    <FrameLayout 
 			android:layout_width="match_parent"
 			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:layout_height="wrap_content"
-			android:ems="10"
-			android:hint="@string/auth_host_url"
-			android:inputType="textUri"
-			android:drawablePadding="5dp"
-			>
-			<requestFocus />
-		</EditText>
-
-        <TextView
+	        >
+			<EditText
+				android:id="@+id/hostUrlInput"
+				android:layout_width="match_parent"
+				android:layout_height="wrap_content"
+				android:hint="@string/auth_host_url"
+				android:inputType="textUri"
+				android:drawablePadding="5dp"
+				android:paddingRight="55dp"
+				>
+				<requestFocus />
+			</EditText>
+			<ImageButton
+			    android:id="@+id/refeshButton"
+			    android:layout_width="48dp"
+			    android:layout_height="48dp"
+			    android:layout_gravity="center_vertical|right"
+			    android:layout_marginRight="5dp"
+			    android:padding="0dp"
+			    android:scaleType="fitCenter"
+			    android:src="@drawable/ic_action_refresh_black"
+            	android:onClick="onRefreshClick"
+				android:visibility="gone"
+				android:background="@android:color/transparent"
+			    />
+		</FrameLayout>
+
+		<TextView
             android:id="@+id/server_status_text"
             android:id="@+id/server_status_text"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_height="wrap_content"

+ 1 - 2
res/menu/account_picker_long_click.xml

@@ -18,7 +18,6 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
 -->
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
 <menu xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item android:id="@+id/change_password" android:title="@string/change_password"></item>
     <item android:id="@+id/delete_account" android:title="@string/delete_account"></item>
     <item android:id="@+id/delete_account" android:title="@string/delete_account"></item>
-    
-
 </menu>
 </menu>

+ 7 - 6
res/values/strings.xml

@@ -51,7 +51,7 @@
     <string name="auth_host_url">Server address</string>
     <string name="auth_host_url">Server address</string>
     <string name="auth_username">Username</string>
     <string name="auth_username">Username</string>
     <string name="auth_password">Password</string>
     <string name="auth_password">Password</string>
-    <string name="auth_register">I am new to %1$s</string>
+    <string name="auth_register">New to %1$s?</string>
     <string name="new_session_uri_error">Incorrect address given</string>
     <string name="new_session_uri_error">Incorrect address given</string>
     <string name="new_session_session_name_error">Incorrect session name</string>
     <string name="new_session_session_name_error">Incorrect session name</string>
     <string name="sync_string_files">Files</string>
     <string name="sync_string_files">Files</string>
@@ -95,6 +95,7 @@
     <string name="common_loading">Loading &#8230;</string>
     <string name="common_loading">Loading &#8230;</string>
     <string name="common_error_unknown">Unknown error</string>
     <string name="common_error_unknown">Unknown error</string>
     <string name="about_title">About</string>
     <string name="about_title">About</string>
+    <string name="change_password">Change password</string>
     <string name="delete_account">Delete account</string>
     <string name="delete_account">Delete account</string>
     <string name="create_account">Create account</string>
     <string name="create_account">Create account</string>
     <string name="upload_chooser_title">Upload from &#8230;</string>
     <string name="upload_chooser_title">Upload from &#8230;</string>
@@ -118,7 +119,7 @@
     <string name="sync_string_contacts">Contacts</string>
     <string name="sync_string_contacts">Contacts</string>
     <string name="sync_fail_ticker">Synchronization failed</string>
     <string name="sync_fail_ticker">Synchronization failed</string>
     <string name="sync_fail_content">Synchronization of %1$s could not be completed</string>
     <string name="sync_fail_content">Synchronization of %1$s could not be completed</string>
-    <string name="sync_fail_content_unauthorized">Invalid credentials for %1$s</string>
+    <string name="sync_fail_content_unauthorized">Invalid password for %1$s</string>
 	<string name="sync_conflicts_in_favourites_ticker">Conflicts found</string>
 	<string name="sync_conflicts_in_favourites_ticker">Conflicts found</string>
 	<string name="sync_conflicts_in_favourites_content">%1$d kept-in-sync files could not be sync\'ed</string>
 	<string name="sync_conflicts_in_favourites_content">%1$d kept-in-sync files could not be sync\'ed</string>
     <string name="sync_fail_in_favourites_ticker">Kept-in-sync files failed</string>
     <string name="sync_fail_in_favourites_ticker">Kept-in-sync files failed</string>
@@ -177,14 +178,14 @@
         <item>60</item>
         <item>60</item>
     </string-array>
     </string-array>
 
 
-    <string name="auth_trying_to_login">Trying to login...</string>
+    <string name="auth_trying_to_login">Trying to login&#8230;</string>
     <string name="auth_no_net_conn_title">No network connection</string>
     <string name="auth_no_net_conn_title">No network connection</string>
     <string name="auth_no_net_conn_message">No network connection has been detected, check your Internet connection and try again.</string>
     <string name="auth_no_net_conn_message">No network connection has been detected, check your Internet connection and try again.</string>
     <string name="auth_connect_anyway">Connect anyway</string>
     <string name="auth_connect_anyway">Connect anyway</string>
     <string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
     <string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
     <string name="auth_nossl_plain_ok_message">The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel.</string>
     <string name="auth_nossl_plain_ok_message">The Application cannot establish a secure connection to the server. A non secure connection is available. You may continue or cancel.</string>
     <string name="auth_connection_established">Connection established</string>
     <string name="auth_connection_established">Connection established</string>
-    <string name="auth_testing_connection">Testing connection...</string>
+    <string name="auth_testing_connection">Testing connection&#8230;</string>
     <string name="auth_not_configured_title">Malformed server configuration</string>
     <string name="auth_not_configured_title">Malformed server configuration</string>
     <string name="auth_not_configured_message">It seems that your server instance is not correctly configured. Contact your administrator for more details.</string>
     <string name="auth_not_configured_message">It seems that your server instance is not correctly configured. Contact your administrator for more details.</string>
     <string name="auth_unknown_error_title">Unknown error occurred!</string>
     <string name="auth_unknown_error_title">Unknown error occurred!</string>
@@ -200,14 +201,14 @@
     <string name="auth_bad_oc_version_title">Unrecognized server version</string>
     <string name="auth_bad_oc_version_title">Unrecognized server version</string>
     <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
     <string name="auth_wrong_connection_title">Couldn\'t establish connection</string>
     <string name="auth_secure_connection">Secure connection established</string>
     <string name="auth_secure_connection">Secure connection established</string>
-    <string name="auth_unauthorized">Invalid credentials</string>
+    <string name="auth_unauthorized">Wrong username or password</string>
 	<string name="auth_oauth_error">Unsuccessful authorization</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_oauth_error_access_denied">Access denied by authorization server</string>
     <string name="auth_not_found">Wrong path given</string>
     <string name="auth_not_found">Wrong path given</string>
     <string name="auth_internal">Internal server error, code %1$d</string>
     <string name="auth_internal">Internal server error, code %1$d</string>
     <string name="auth_wtf_reenter_URL">Unexpected state; please, enter the server URL again</string>
     <string name="auth_wtf_reenter_URL">Unexpected state; please, enter the server URL again</string>
     <string name="auth_expired_oauth_token_toast">Your authorization expired.\nPlease, authorize again</string>
     <string name="auth_expired_oauth_token_toast">Your authorization expired.\nPlease, authorize again</string>
-    <string name="auth_expired_basic_auth_toast">Your saved credentials are invalid.\nPlease, enter the current credentials</string>
+    <string name="auth_expired_basic_auth_toast">Please, enter the current password</string>
     
     
     <string name="crashlog_message">Application terminated unexpectedly. Would you like to submit a crash report?</string>
     <string name="crashlog_message">Application terminated unexpectedly. Would you like to submit a crash report?</string>
     <string name="crashlog_send_report">Send report</string>
     <string name="crashlog_send_report">Send report</string>

+ 1 - 0
src/com/owncloud/android/authentication/AccountAuthenticator.java

@@ -190,6 +190,7 @@ public class AccountAuthenticator extends AbstractAccountAuthenticator {
         intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
         intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType);
         intent.putExtra(KEY_LOGIN_OPTIONS, options);
         intent.putExtra(KEY_LOGIN_OPTIONS, options);
         intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
         intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account);
+        intent.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
         intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
         intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
         
         
 
 

+ 33 - 29
src/com/owncloud/android/authentication/AuthenticatorActivity.java

@@ -60,6 +60,7 @@ import android.view.inputmethod.EditorInfo;
 import android.widget.CheckBox;
 import android.widget.CheckBox;
 import android.widget.EditText;
 import android.widget.EditText;
 import android.widget.Button;
 import android.widget.Button;
+import android.widget.ImageButton;
 import android.widget.TextView;
 import android.widget.TextView;
 import android.widget.Toast;
 import android.widget.Toast;
 import android.widget.TextView.OnEditorActionListener;
 import android.widget.TextView.OnEditorActionListener;
@@ -83,6 +84,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     public static final String EXTRA_USER_NAME = "USER_NAME";
     public static final String EXTRA_USER_NAME = "USER_NAME";
     public static final String EXTRA_HOST_NAME = "HOST_NAME";
     public static final String EXTRA_HOST_NAME = "HOST_NAME";
     public static final String EXTRA_ACTION = "ACTION";
     public static final String EXTRA_ACTION = "ACTION";
+    public static final String EXTRA_ENFORCED_UPDATE = "ENFORCE_UPDATE";
 
 
     private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
     private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
     private static final String KEY_OC_VERSION = "OC_VERSION";
     private static final String KEY_OC_VERSION = "OC_VERSION";
@@ -109,7 +111,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 
 
     public static final byte ACTION_CREATE = 0;
     public static final byte ACTION_CREATE = 0;
     public static final byte ACTION_UPDATE_TOKEN = 1;
     public static final byte ACTION_UPDATE_TOKEN = 1;
-    
+
     private String mHostBaseUrl;
     private String mHostBaseUrl;
     private OwnCloudVersion mDiscoveredVersion;
     private OwnCloudVersion mDiscoveredVersion;
 
 
@@ -131,6 +133,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
     private Account mAccount;
     private Account mAccount;
 
 
     private EditText mHostUrlInput;
     private EditText mHostUrlInput;
+    private ImageButton mRefreshButton;
     private EditText mUsernameInput;
     private EditText mUsernameInput;
     private EditText mPasswordInput;
     private EditText mPasswordInput;
     private CheckBox mOAuth2Check;
     private CheckBox mOAuth2Check;
@@ -157,6 +160,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         /// set view and get references to view elements
         /// set view and get references to view elements
         setContentView(R.layout.account_setup);
         setContentView(R.layout.account_setup);
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);
         mHostUrlInput = (EditText) findViewById(R.id.hostUrlInput);
+        mRefreshButton = (ImageButton) findViewById(R.id.refeshButton);
         mUsernameInput = (EditText) findViewById(R.id.account_username);
         mUsernameInput = (EditText) findViewById(R.id.account_username);
         mPasswordInput = (EditText) findViewById(R.id.account_password);
         mPasswordInput = (EditText) findViewById(R.id.account_password);
         mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);
         mOAuthAuthEndpointText = (TextView)findViewById(R.id.oAuthEntryPoint_1);
@@ -177,6 +181,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); 
         mAction = getIntent().getByteExtra(EXTRA_ACTION, ACTION_CREATE); 
         mAccount = null;
         mAccount = null;
         mHostBaseUrl = "";
         mHostBaseUrl = "";
+        boolean refreshButtonEnabled = false;
 
 
         if (savedInstanceState == null) {
         if (savedInstanceState == null) {
             /// connection state and info
             /// connection state and info
@@ -204,7 +209,11 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             }
             }
             mOAuth2Check.setChecked(oAuthRequired);
             mOAuth2Check.setChecked(oAuthRequired);
             changeViewByOAuth2Check(oAuthRequired);
             changeViewByOAuth2Check(oAuthRequired);
-
+            mJustCreated = true;
+            
+            if (mAction == ACTION_UPDATE_TOKEN) {
+                checkOcServer(); 
+            }
 
 
         } else {
         } else {
             /// connection state and info
             /// connection state and info
@@ -235,43 +244,35 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
             }            
             }            
             
             
             // refresh button enabled
             // refresh button enabled
-            mRefreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);
+            refreshButtonEnabled = savedInstanceState.getBoolean(KEY_REFRESH_BUTTON_ENABLED);
+            
 
 
         }
         }
 
 
         showServerStatus();
         showServerStatus();
         showAuthStatus();
         showAuthStatus();
-        if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton();
-        mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes
-
-        if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {
-            mOAuth2Check.setVisibility(View.GONE);
-        }
 
 
         if (mAction == ACTION_UPDATE_TOKEN) {
         if (mAction == ACTION_UPDATE_TOKEN) {
             /// lock things that should not change
             /// lock things that should not change
             mHostUrlInput.setEnabled(false);
             mHostUrlInput.setEnabled(false);
+            mHostUrlInput.setFocusable(false);
             mUsernameInput.setEnabled(false);
             mUsernameInput.setEnabled(false);
+            mUsernameInput.setFocusable(false);
+            mOAuth2Check.setVisibility(View.GONE);
+        }
+        
+        //if (mServerIsChecked && !mServerIsValid && mRefreshButtonEnabled) showRefreshButton();
+        if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled) showRefreshButton();
+        mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes
+
+        if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) {
             mOAuth2Check.setVisibility(View.GONE);
             mOAuth2Check.setVisibility(View.GONE);
-            if (!mServerIsValid && mOcServerChkOperation == null) {
-                checkOcServer(); 
-            }
         }
         }
 
 
         mPasswordInput.setText("");     // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)
         mPasswordInput.setText("");     // clean password to avoid social hacking (disadvantage: password in removed if the device is turned aside)
-        mJustCreated = true;
 
 
         /// bind view elements to listeners
         /// bind view elements to listeners
         mHostUrlInput.setOnFocusChangeListener(this);
         mHostUrlInput.setOnFocusChangeListener(this);
-        mHostUrlInput.setOnTouchListener(new RightDrawableOnTouchListener() {
-            @Override
-            public boolean onDrawableTouch(final MotionEvent event) {
-                if (event.getAction() == MotionEvent.ACTION_UP) {
-                    AuthenticatorActivity.this.onRefreshClick();
-                }
-                return true;
-            }
-        });
         mHostUrlInput.addTextChangedListener(new TextWatcher() {
         mHostUrlInput.addTextChangedListener(new TextWatcher() {
 
 
             @Override
             @Override
@@ -337,7 +338,8 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         }
         }
         
         
         // refresh button enabled
         // refresh button enabled
-        outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled);
+        //outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, mRefreshButtonEnabled);
+        outState.putBoolean(KEY_REFRESH_BUTTON_ENABLED, (mRefreshButton.getVisibility() == View.VISIBLE));
 
 
     }
     }
 
 
@@ -368,7 +370,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
         super.onResume();
         super.onResume();
         // the state of mOAuth2Check is automatically recovered between configuration changes, but not before onCreate() finishes; so keep the next lines here
         // the state of mOAuth2Check is automatically recovered between configuration changes, but not before onCreate() finishes; so keep the next lines here
         changeViewByOAuth2Check(mOAuth2Check.isChecked());  
         changeViewByOAuth2Check(mOAuth2Check.isChecked());  
-        if (mAction == ACTION_UPDATE_TOKEN && mJustCreated) {
+        if (mAction == ACTION_UPDATE_TOKEN && mJustCreated && getIntent().getBooleanExtra(EXTRA_ENFORCED_UPDATE, false)) {
             if (mOAuth2Check.isChecked())
             if (mOAuth2Check.isChecked())
                 Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show();
                 Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show();
             else
             else
@@ -1193,13 +1195,15 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
 
 
 
 
     private void showRefreshButton() {
     private void showRefreshButton() {
-        mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);
-        mRefreshButtonEnabled = true;
+        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_action_refresh_black, 0);
+        mRefreshButtonEnabled = true;*/
+        mRefreshButton.setVisibility(View.VISIBLE);
     }
     }
 
 
     private void hideRefreshButton() {
     private void hideRefreshButton() {
-        mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
-        mRefreshButtonEnabled = false;
+        /*mHostUrlInput.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
+        mRefreshButtonEnabled = false;*/
+        mRefreshButton.setVisibility(View.GONE);
     }
     }
 
 
     /**
     /**
@@ -1209,7 +1213,7 @@ implements  OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
      * 
      * 
      * @param view      Refresh 'button'
      * @param view      Refresh 'button'
      */
      */
-    public void onRefreshClick() {
+    public void onRefreshClick(View view) {
         checkOcServer();
         checkOcServer();
     }
     }
     
     

+ 1 - 0
src/com/owncloud/android/files/services/FileDownloader.java

@@ -468,6 +468,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis
                 // let the user update credentials with one click
                 // let the user update credentials with one click
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, download.getAccount());
+                updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

+ 1 - 0
src/com/owncloud/android/files/services/FileUploader.java

@@ -795,6 +795,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
                 // let the user update credentials with one click
                 // let the user update credentials with one click
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
                 Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount());
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, upload.getAccount());
+                updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
                 updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
                 updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

+ 1 - 0
src/com/owncloud/android/syncadapter/FileSyncAdapter.java

@@ -303,6 +303,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
             // let the user update credentials with one click
             // let the user update credentials with one click
             Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
             Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);
             updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());
             updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());
+            updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ENFORCED_UPDATE, true);
             updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
             updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
             updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);

+ 19 - 5
src/com/owncloud/android/ui/activity/AccountSelectActivity.java

@@ -48,6 +48,7 @@ import com.actionbarsherlock.view.Menu;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuInflater;
 import com.actionbarsherlock.view.MenuItem;
 import com.actionbarsherlock.view.MenuItem;
 import com.owncloud.android.authentication.AccountAuthenticator;
 import com.owncloud.android.authentication.AccountAuthenticator;
+import com.owncloud.android.authentication.AuthenticatorActivity;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.authentication.AccountUtils;
 import com.owncloud.android.Log_OC;
 import com.owncloud.android.Log_OC;
 
 
@@ -142,11 +143,17 @@ public class AccountSelectActivity extends SherlockListActivity implements
         return false;
         return false;
     }
     }
 
 
+    /**
+     * Called when the user clicked on an item into the context menu created at 
+     * {@link #onCreateContextMenu(ContextMenu, View, ContextMenuInfo)} for every
+     * ownCloud {@link Account} , containing 'secondary actions' for them.
+     * 
+     * {@inheritDoc}}
+     */
     @SuppressWarnings("unchecked")
     @SuppressWarnings("unchecked")
     @Override
     @Override
     public boolean onContextItemSelected(android.view.MenuItem item) {
     public boolean onContextItemSelected(android.view.MenuItem item) {
-        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item
-                .getMenuInfo();
+        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
         int index = info.position;
         int index = info.position;
         HashMap<String, String> map = null;
         HashMap<String, String> map = null;
         try {
         try {
@@ -158,11 +165,18 @@ public class AccountSelectActivity extends SherlockListActivity implements
         
         
         String accountName = map.get("NAME");
         String accountName = map.get("NAME");
         AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
         AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
-        Account accounts[] = am
-                .getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
+        Account accounts[] = am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE);
         for (Account a : accounts) {
         for (Account a : accounts) {
             if (a.name.equals(accountName)) {
             if (a.name.equals(accountName)) {
-                am.removeAccount(a, this, mHandler);
+                if (item.getItemId() == R.id.change_password) {
+                    Intent updateAccountCredentials = new Intent(this, AuthenticatorActivity.class);
+                    updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, a);
+                    updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);
+                    startActivity(updateAccountCredentials);
+                    
+                } else if (item.getItemId() == R.id.delete_account) {
+                    am.removeAccount(a, this, mHandler);
+                }
             }
             }
         }
         }