use of com.google.firebase.auth.FirebaseUser in project PhotoBlog-Android-Blog-App by akshayejh.
the class RegisterActivity method onStart.
@Override
protected void onStart() {
super.onStart();
FirebaseUser currentUser = mAuth.getCurrentUser();
if (currentUser != null) {
sendToMain();
}
}
use of com.google.firebase.auth.FirebaseUser in project EC2018App by Manan-YMCA.
the class FragmentFbLogin method handleFacebookAccessToken.
private void handleFacebookAccessToken(AccessToken token) {
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
mAuth.signInWithCredential(credential).addOnCompleteListener((Activity) mContext, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = mAuth.getCurrentUser();
barLogin.setVisibility(View.GONE);
dismiss();
} else {
// If sign in fails, display a message to the user.
MDToast.makeText(mContext, "Authentication failed.", Toast.LENGTH_SHORT, MDToast.TYPE_ERROR).show();
dismiss();
}
}
});
}
use of com.google.firebase.auth.FirebaseUser in project EC2018App by Manan-YMCA.
the class QuestionFragment method handleFacebookAccessToken.
private void handleFacebookAccessToken(AccessToken token) {
AuthCredential credential = FacebookAuthProvider.getCredential(token.getToken());
mAuth.signInWithCredential(credential).addOnCompleteListener((Activity) mContext, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
FirebaseUser user = mAuth.getCurrentUser();
} else {
// If sign in fails, display a message to the user.
MDToast.makeText(mContext, "Authentication failed.", Toast.LENGTH_SHORT).show();
}
}
});
}
use of com.google.firebase.auth.FirebaseUser in project CSCI3130 by T-Caines.
the class LoginActivity method signIn.
public void signIn(View view) {
String user = ((EditText) findViewById(R.id.email_sign_in)).getText().toString();
String password = ((EditText) findViewById(R.id.password_sign_in)).getText().toString();
dbAuth.signInWithEmailAndPassword(user, password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithEmail:success");
FirebaseUser user = dbAuth.getCurrentUser();
if (user != null) {
Intent calendar = new Intent(LoginActivity.this, CourseViewer.class);
startActivity(calendar);
}
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithEmail:failure", task.getException());
Toast.makeText(LoginActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show();
((TextView) findViewById(R.id.error_sign_in)).setText(" Invalid username or password ");
}
}
});
}
use of com.google.firebase.auth.FirebaseUser in project CSCI3130 by T-Caines.
the class SignUpActivity method onClick.
public void onClick(View view) {
final EditText user = (EditText) findViewById(R.id.sign_up_user);
final EditText password = (EditText) findViewById(R.id.sign_up_password);
final EditText confirm = (EditText) findViewById(R.id.sign_up_password_confirm);
if (!password.getText().toString().equals(confirm.getText().toString())) {
((TextView) findViewById(R.id.error_sign_up)).setText(" Passwords do not match ");
return;
}
dbAuth.createUserWithEmailAndPassword(user.getText().toString(), password.getText().toString()).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
FirebaseUser user = dbAuth.getCurrentUser();
Log.d(TAG, "signUpWithEmail:success");
finish();
} else {
Toast.makeText(SignUpActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show();
((TextView) findViewById(R.id.error_sign_up)).setText(" Username already exists ");
}
}
});
}
Aggregations