Search in sources :

Example 1 with AuthentificationPortailTask

use of ca.etsmtl.applets.etsmobile.http.AuthentificationPortailTask in project ETSMobile-Android2 by ApplETS.

the class LoginActivity method onRequestSuccess.

@Override
public void onRequestSuccess(Object o) {
    showProgress(false);
    if (o != null) {
        Etudiant etudiant = (Etudiant) o;
        if (etudiant.erreur != null) {
            mPasswordView.setError(getString(R.string.error_invalid_pwd));
            mPasswordView.requestFocus();
        } else {
            ApplicationManager.userCredentials = userCredentials;
            TodayWidgetProvider.updateAllWidgets(this);
            String accountName = userCredentials.getUsername();
            String accountPassword = userCredentials.getPassword();
            createETSMobileAccount(accountName, accountPassword);
            startActivity(new Intent(LoginActivity.this, MainActivity.class));
            //Run authentication to monETS in another thread not to slow app
            new AuthentificationPortailTask(this).execute(getString(R.string.portail_api_authentification_url), ApplicationManager.userCredentials.getUsername(), ApplicationManager.userCredentials.getPassword());
            finishActivity(1);
        }
    } else {
        mPasswordView.setError(getString(R.string.error_invalid_email));
        mPasswordView.requestFocus();
    }
}
Also used : Etudiant(ca.etsmtl.applets.etsmobile.model.Etudiant) Intent(android.content.Intent) AuthentificationPortailTask(ca.etsmtl.applets.etsmobile.http.AuthentificationPortailTask)

Aggregations

Intent (android.content.Intent)1 AuthentificationPortailTask (ca.etsmtl.applets.etsmobile.http.AuthentificationPortailTask)1 Etudiant (ca.etsmtl.applets.etsmobile.model.Etudiant)1