Added incorrect user or password error message

git-svn-id: https://forja.rediris.es/svn/cusl6-swadroid/trunk@155 5bc14d19-1e4b-4ba2-aa50-860af135f48c
This commit is contained in:
Juan Miguel Boyero Corral 2011-11-22 22:14:38 +00:00
parent e9bfb09c78
commit 09ac8a9cf9
4 changed files with 31 additions and 22 deletions

View File

@ -28,6 +28,8 @@
<string name="coursesProgressDescription">Obteniendo asignaturas...</string>
<string name="notificationsProgressTitle">Notificaciones</string>
<string name="notificationsProgressDescription">Obteniendo nuevas notificaciones</string>
<string name="testsDownloadProgressTitle">Tests</string>
<string name="testsDownloadProgressDescription">Obteniendo preguntas de test...</string>
<string name="errorMsgWorkaroundEmulator">Mierda. Ese bug del emulador de Android ha vuelto a
aparecer. Reintentando...</string>
<string name="errorMsgLaunchingActivity">Ha ocurrido un error durante la ejecución de la
@ -50,6 +52,11 @@
<string name="noContentMsg">Sin contenido</string>
<string name="yesMsg"></string>
<string name="noMsg">No</string>
<string name="acceptMsg">Aceptar</string>
<string name="cancelMsg">Cancelar</string>
<string name="selectCourseTitle">Seleccione asignatura</string>
<string name="noCourseSelectedMsg">Debe seleccionar una asignatura para descargar los tests</string>
<string name="forbiddenCourseTestsDownloadMsg">El profesor de esta asignatura no permite la descarga de tests</string>
<string name="firstRunMsg">Antes de usar la aplicación por primera vez debe
introducir el nombre de usuario y la contraseña de acceso a SWAD en la
pantalla de configuración.\n\nPuede acceder a la pantalla de
@ -59,11 +66,9 @@
<string name="upgradeMsg">Debido a cambios en la base de datos todos los
datos de las notificaciones han sido borrados.\n\nDisculpe las
molestias.</string>
<string name="errorBadLoginMsg">Usuario o contraseña incorrectos</string>
<string name="errorServerResponseMsg">Error en respuesta del servidor</string>
<string name="errorConnectionMsg">Error durante la conexión con el servidor</string>
<string name="errorTimeoutMsg">Tiempo de espera agotado intentando conectar con el
servidor</string>
</resources>

View File

@ -26,6 +26,8 @@
<string name="loginProgressDescription">Connecting...</string>
<string name="notificationsProgressTitle">Notifications</string>
<string name="notificationsProgressDescription">Retrieving new notifications</string>
<string name="testsDownloadProgressTitle">Tests</string>
<string name="testsDownloadProgressDescription">Obtaining test questions...</string>
<string name="coursesProgressTitle">Courses</string>
<string name="coursesProgressDescription">Retrieving courses...</string>
<string name="errorMsgLaunchingActivity">An error occurred during the execution of the
@ -51,6 +53,11 @@
<string name="noContentMsg">No content</string>
<string name="yesMsg">Yes</string>
<string name="noMsg">No</string>
<string name="acceptMsg">Ok</string>
<string name="cancelMsg">Cancel</string>
<string name="selectCourseTitle">Select course</string>
<string name="noCourseSelectedMsg">You must select a course to download tests</string>
<string name="forbiddenCourseTestsDownloadMsg">The teacher of this course does not allows the tests download</string>
<string name="initialDialogTitle">IMPORTANT</string>
<string name="firstRunMsg">Before using the application for the first time you
must enter the user name and password for SWAD at the setup
@ -59,18 +66,8 @@
</string>
<string name="upgradeMsg">Due to changes in the database all notifications
data have been deleted.\n\nSorry.</string>
<string name="errorBadLoginMsg">Incorrect user or password</string>
<string name="errorServerResponseMsg">Error in server response</string>
<string name="errorConnectionMsg">Error while connecting to server</string>
<string name="errorTimeoutMsg">Timeout trying to connect to the server</string>
</resources>

View File

@ -72,7 +72,7 @@ public class Login extends Module {
protected void connect() {
String progressDescription = getString(R.string.loginProgressDescription);
int progressTitle = R.string.loginProgressTitle;
Connect con = new Connect(false, progressDescription, progressTitle);
Connect con = new Connect(false, progressDescription, progressTitle, true);
Toast.makeText(this, progressDescription, Toast.LENGTH_LONG).show();
con.execute();

View File

@ -457,7 +457,7 @@ public abstract class Module extends Activity {
.setNeutralButton(R.string.close_dialog,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Module.this.finish();
finish();
}
})
.setIcon(R.drawable.erroricon).show();
@ -501,27 +501,29 @@ public abstract class Module extends Activity {
*/
protected class Connect extends AsyncTask<String, Void, Void> {
/**
* Progress dialog.
* Progress dialog
*/
ProgressDialog dialog = new ProgressDialog(Module.this);
/**
* Exception pointer.
* Exception pointer
*/
Exception e = null;
String progressDescription;
int progressTitle;
boolean showDialog;
boolean showDialog, isLoginModule;
/**
* Shows progress dialog and connects to SWAD in background
* @param progressDescription Description to be showed in dialog
* @param progressTitle Title to be showed in dialog
*/
public Connect(boolean showDialog, String progressDescription, int progressTitle) {
public Connect(boolean showDialog, String progressDescription, int progressTitle, Boolean... isLogin) {
super();
this.progressDescription = progressDescription;
this.progressTitle = progressTitle;
this.showDialog = showDialog;
assert isLogin.length <= 1;
this.isLoginModule = isLogin.length > 0 ? isLogin[0].booleanValue() : false;
}
/* (non-Javadoc)
@ -584,11 +586,16 @@ public abstract class Module extends Activity {
*/
if(e instanceof SoapFault) {
SoapFault es = (SoapFault) e;
if(isLoginModule)
errorMsg = getString(R.string.errorBadLoginMsg);
else
errorMsg = es.getMessage();
if(isDebuggable)
Log.e(es.getClass().getSimpleName(), es.getMessage());
Log.e(e.getClass().getSimpleName(), errorMsg);
error(es.getMessage());
error(errorMsg);
} else if (e instanceof XmlPullParserException) {
errorMsg = getString(R.string.errorServerResponseMsg);