summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/LogInDialog.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-07-02 19:20:58 +0200
committerSean Leonard <meanderingcode@aetherislands.net>2013-07-12 14:26:29 -0600
commit99a4d94564635f0223d447bc9bcf081cadd8ff36 (patch)
tree1beba3aeacae1e2e278a5bbaffa3cf44ce527154 /src/se/leap/leapclient/LogInDialog.java
parent210b562bd474e7d8c22becf62ea52399f0a6d9f9 (diff)
User messages are added to the new recovery dialog
When login is not successful, a new recovery dialog is prompted with a message about the previous error.
Diffstat (limited to 'src/se/leap/leapclient/LogInDialog.java')
-rw-r--r--src/se/leap/leapclient/LogInDialog.java26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/se/leap/leapclient/LogInDialog.java b/src/se/leap/leapclient/LogInDialog.java
index 99b19628..0536c6df 100644
--- a/src/se/leap/leapclient/LogInDialog.java
+++ b/src/se/leap/leapclient/LogInDialog.java
@@ -9,7 +9,7 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
-import android.widget.Toast;
+import android.widget.TextView;
/**
* Implements the log in dialog, currently without progress dialog.
@@ -22,12 +22,16 @@ import android.widget.Toast;
*
*/
public class LogInDialog extends DialogFragment {
-
+
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View log_in_dialog_view = inflater.inflate(R.layout.log_in_dialog, null);
-
+
+ final TextView user_message = (TextView)log_in_dialog_view.findViewById(R.id.user_message);
+ if(getArguments() != null && getArguments().containsKey(getResources().getString(R.string.user_message))) {
+ user_message.setText(getArguments().getString(getResources().getString(R.string.user_message)));
+ } else user_message.setVisibility(View.GONE);
final EditText username_field = (EditText)log_in_dialog_view.findViewById(R.id.username_entered);
final EditText password_field = (EditText)log_in_dialog_view.findViewById(R.id.password_entered);
@@ -36,12 +40,7 @@ public class LogInDialog extends DialogFragment {
public void onClick(DialogInterface dialog, int id) {
String username = username_field.getText().toString().trim();
String password = password_field.getText().toString().trim();
- if(wellFormedPassword(password)) {
- interface_with_Dashboard.authenticate(username, password);
- } else {
- password_field.setText("");
- Toast.makeText(getActivity().getApplicationContext(), R.string.not_valid_password_message, Toast.LENGTH_LONG).show();
- }
+ interface_with_Dashboard.authenticate(username, password);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@@ -52,15 +51,6 @@ public class LogInDialog extends DialogFragment {
return builder.create();
}
-
- /**
- * Validates a password
- * @param entered_password
- * @return true if the entered password length is greater or equal to eight (8).
- */
- private boolean wellFormedPassword(String entered_password) {
- return entered_password.length() >= 8;
- }
/**
* Interface used to communicate LogInDialog with Dashboard.