├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── google-services.json
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── net
│ │ └── smallacademy
│ │ └── authenticatorapp
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── net
│ │ │ └── smallacademy
│ │ │ └── authenticatorapp
│ │ │ ├── EditProfile.java
│ │ │ ├── Login.java
│ │ │ ├── MainActivity.java
│ │ │ └── Register.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── ic_email_black_24dp.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_local_phone_black_24dp.xml
│ │ ├── ic_person_black_24dp.xml
│ │ └── walpaper.jpg
│ │ ├── font
│ │ └── aclonica.xml
│ │ ├── layout
│ │ ├── activity_edit_profile.xml
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ └── activity_register.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── font_certs.xml
│ │ ├── preloaded_fonts.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── net
│ └── smallacademy
│ └── authenticatorapp
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | xmlns:android
14 |
15 | ^$
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | xmlns:.*
25 |
26 | ^$
27 |
28 |
29 | BY_NAME
30 |
31 |
32 |
33 |
34 |
35 |
36 | .*:id
37 |
38 | http://schemas.android.com/apk/res/android
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | .*:name
48 |
49 | http://schemas.android.com/apk/res/android
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | name
59 |
60 | ^$
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 | style
70 |
71 | ^$
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | .*
81 |
82 | ^$
83 |
84 |
85 | BY_NAME
86 |
87 |
88 |
89 |
90 |
91 |
92 | .*
93 |
94 | http://schemas.android.com/apk/res/android
95 |
96 |
97 | ANDROID_ATTRIBUTE_ORDER
98 |
99 |
100 |
101 |
102 |
103 |
104 | .*
105 |
106 | .*
107 |
108 |
109 | BY_NAME
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Firebase Email Authentication Example App
2 |
3 | In this application i have implemented firebase email authentication system. where user can create new account, login using the email and password.
4 |
5 | ## Features
6 | 1. Create New account with email
7 | 2. Saved user Data with FireStore
8 | 3. Forgot Password options
9 | 4. Verify User Email
10 |
11 | #This android app source code is provided for the Video Tutorial Series on youtube channel (SmallAcademy) You can watch Full tutorial series here.
12 |
13 | https://www.youtube.com/embed/videoseries?list=PLlGT4GXi8_8dDK5Y3KCxuKAPpil9V49rN
14 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'com.google.gms.google-services'
3 |
4 | android {
5 | compileSdkVersion 29
6 | buildToolsVersion "29.0.3"
7 | defaultConfig {
8 | applicationId "net.smallacademy.authenticatorapp"
9 | minSdkVersion 21
10 | targetSdkVersion 29
11 | versionCode 1
12 | versionName "1.0"
13 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | }
22 |
23 | dependencies {
24 | implementation fileTree(dir: 'libs', include: ['*.jar'])
25 | implementation 'androidx.appcompat:appcompat:1.1.0'
26 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
27 | implementation 'com.google.firebase:firebase-auth:19.3.0'
28 | implementation 'com.google.firebase:firebase-firestore:21.4.2'
29 | implementation 'com.google.firebase:firebase-storage:19.1.1'
30 | testImplementation 'junit:junit:4.13'
31 | androidTestImplementation 'androidx.test:runner:1.2.0'
32 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
33 | implementation 'com.squareup.picasso:picasso:2.71828'
34 | }
35 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "562743464498",
4 | "firebase_url": "https://authenticatorapp-2c565.firebaseio.com",
5 | "project_id": "authenticatorapp-2c565",
6 | "storage_bucket": "authenticatorapp-2c565.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:562743464498:android:adc44e6c5e6e0d3b15222b",
12 | "android_client_info": {
13 | "package_name": "net.smallacademy.authenticatorapp"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "562743464498-s3hn5ndhvh51r0nau8lk1bgc1d8fbvqu.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "net.smallacademy.authenticatorapp",
22 | "certificate_hash": "dfcfbc2c058958fe14455396f8d674241f74c5a7"
23 | }
24 | },
25 | {
26 | "client_id": "562743464498-eal0p20k25ibearlj60scq92ge6l57rt.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyCbMJ2sSrC0tr4SgN3iE_eQMs7fFsMss1Q"
33 | }
34 | ],
35 | "services": {
36 | "appinvite_service": {
37 | "other_platform_oauth_client": [
38 | {
39 | "client_id": "562743464498-eal0p20k25ibearlj60scq92ge6l57rt.apps.googleusercontent.com",
40 | "client_type": 3
41 | }
42 | ]
43 | }
44 | }
45 | }
46 | ],
47 | "configuration_version": "1"
48 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/net/smallacademy/authenticatorapp/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 |
25 | assertEquals("net.smallacademy.authenticatorapp", appContext.getPackageName());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/net/smallacademy/authenticatorapp/EditProfile.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AppCompatActivity;
5 |
6 | import android.app.Activity;
7 | import android.content.Intent;
8 | import android.net.Uri;
9 | import android.os.Bundle;
10 | import android.provider.MediaStore;
11 | import android.util.Log;
12 | import android.view.View;
13 | import android.widget.Button;
14 | import android.widget.EditText;
15 | import android.widget.ImageView;
16 | import android.widget.Toast;
17 |
18 | import com.google.android.gms.tasks.OnFailureListener;
19 | import com.google.android.gms.tasks.OnSuccessListener;
20 | import com.google.firebase.auth.FirebaseAuth;
21 | import com.google.firebase.auth.FirebaseUser;
22 | import com.google.firebase.firestore.DocumentReference;
23 | import com.google.firebase.firestore.FirebaseFirestore;
24 | import com.google.firebase.storage.FirebaseStorage;
25 | import com.google.firebase.storage.StorageReference;
26 | import com.google.firebase.storage.UploadTask;
27 | import com.squareup.picasso.Picasso;
28 |
29 | import java.util.HashMap;
30 | import java.util.Map;
31 |
32 | public class EditProfile extends AppCompatActivity {
33 |
34 | public static final String TAG = "TAG";
35 | EditText profileFullName,profileEmail,profilePhone;
36 | ImageView profileImageView;
37 | Button saveBtn;
38 | FirebaseAuth fAuth;
39 | FirebaseFirestore fStore;
40 | FirebaseUser user;
41 | StorageReference storageReference;
42 |
43 | @Override
44 | protected void onCreate(Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_edit_profile);
47 |
48 | Intent data = getIntent();
49 | final String fullName = data.getStringExtra("fullName");
50 | String email = data.getStringExtra("email");
51 | String phone = data.getStringExtra("phone");
52 |
53 | fAuth = FirebaseAuth.getInstance();
54 | fStore = FirebaseFirestore.getInstance();
55 | user = fAuth.getCurrentUser();
56 | storageReference = FirebaseStorage.getInstance().getReference();
57 |
58 | profileFullName = findViewById(R.id.profileFullName);
59 | profileEmail = findViewById(R.id.profileEmailAddress);
60 | profilePhone = findViewById(R.id.profilePhoneNo);
61 | profileImageView = findViewById(R.id.profileImageView);
62 | saveBtn = findViewById(R.id.saveProfileInfo);
63 |
64 | StorageReference profileRef = storageReference.child("users/"+fAuth.getCurrentUser().getUid()+"/profile.jpg");
65 | profileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
66 | @Override
67 | public void onSuccess(Uri uri) {
68 | Picasso.get().load(uri).into(profileImageView);
69 | }
70 | });
71 |
72 | profileImageView.setOnClickListener(new View.OnClickListener() {
73 | @Override
74 | public void onClick(View v) {
75 | Intent openGalleryIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
76 | startActivityForResult(openGalleryIntent,1000);
77 | }
78 | });
79 |
80 | saveBtn.setOnClickListener(new View.OnClickListener() {
81 | @Override
82 | public void onClick(View v) {
83 | if(profileFullName.getText().toString().isEmpty() || profileEmail.getText().toString().isEmpty() || profilePhone.getText().toString().isEmpty()){
84 | Toast.makeText(EditProfile.this, "One or Many fields are empty.", Toast.LENGTH_SHORT).show();
85 | return;
86 | }
87 |
88 | final String email = profileEmail.getText().toString();
89 | user.updateEmail(email).addOnSuccessListener(new OnSuccessListener() {
90 | @Override
91 | public void onSuccess(Void aVoid) {
92 | DocumentReference docRef = fStore.collection("users").document(user.getUid());
93 | Map edited = new HashMap<>();
94 | edited.put("email",email);
95 | edited.put("fName",profileFullName.getText().toString());
96 | edited.put("phone",profilePhone.getText().toString());
97 | docRef.update(edited).addOnSuccessListener(new OnSuccessListener() {
98 | @Override
99 | public void onSuccess(Void aVoid) {
100 | Toast.makeText(EditProfile.this, "Profile Updated", Toast.LENGTH_SHORT).show();
101 | startActivity(new Intent(getApplicationContext(),MainActivity.class));
102 | finish();
103 | }
104 | });
105 | Toast.makeText(EditProfile.this, "Email is changed.", Toast.LENGTH_SHORT).show();
106 | }
107 | }).addOnFailureListener(new OnFailureListener() {
108 | @Override
109 | public void onFailure(@NonNull Exception e) {
110 | Toast.makeText(EditProfile.this, e.getMessage(), Toast.LENGTH_SHORT).show();
111 | }
112 | });
113 |
114 |
115 | }
116 | });
117 |
118 | profileEmail.setText(email);
119 | profileFullName.setText(fullName);
120 | profilePhone.setText(phone);
121 |
122 | Log.d(TAG, "onCreate: " + fullName + " " + email + " " + phone);
123 | }
124 |
125 |
126 | @Override
127 | protected void onActivityResult(int requestCode, int resultCode, @androidx.annotation.Nullable Intent data) {
128 | super.onActivityResult(requestCode, resultCode, data);
129 | if(requestCode == 1000){
130 | if(resultCode == Activity.RESULT_OK){
131 | Uri imageUri = data.getData();
132 |
133 | //profileImage.setImageURI(imageUri);
134 |
135 | uploadImageToFirebase(imageUri);
136 |
137 |
138 | }
139 | }
140 |
141 | }
142 |
143 | private void uploadImageToFirebase(Uri imageUri) {
144 | // uplaod image to firebase storage
145 | final StorageReference fileRef = storageReference.child("users/"+fAuth.getCurrentUser().getUid()+"/profile.jpg");
146 | fileRef.putFile(imageUri).addOnSuccessListener(new OnSuccessListener() {
147 | @Override
148 | public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
149 | fileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
150 | @Override
151 | public void onSuccess(Uri uri) {
152 | Picasso.get().load(uri).into(profileImageView);
153 | }
154 | });
155 | }
156 | }).addOnFailureListener(new OnFailureListener() {
157 | @Override
158 | public void onFailure(@NonNull Exception e) {
159 | Toast.makeText(getApplicationContext(), "Failed.", Toast.LENGTH_SHORT).show();
160 | }
161 | });
162 |
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/app/src/main/java/net/smallacademy/authenticatorapp/Login.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import android.content.DialogInterface;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.text.TextUtils;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.ProgressBar;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import androidx.annotation.NonNull;
15 | import androidx.appcompat.app.AlertDialog;
16 | import androidx.appcompat.app.AppCompatActivity;
17 |
18 | import com.google.android.gms.tasks.OnCompleteListener;
19 | import com.google.android.gms.tasks.OnFailureListener;
20 | import com.google.android.gms.tasks.OnSuccessListener;
21 | import com.google.android.gms.tasks.Task;
22 | import com.google.firebase.auth.AuthResult;
23 | import com.google.firebase.auth.FirebaseAuth;
24 |
25 | public class Login extends AppCompatActivity {
26 | EditText mEmail,mPassword;
27 | Button mLoginBtn;
28 | TextView mCreateBtn,forgotTextLink;
29 | ProgressBar progressBar;
30 | FirebaseAuth fAuth;
31 |
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_login);
37 |
38 | mEmail = findViewById(R.id.Email);
39 | mPassword = findViewById(R.id.password);
40 | progressBar = findViewById(R.id.progressBar);
41 | fAuth = FirebaseAuth.getInstance();
42 | mLoginBtn = findViewById(R.id.loginBtn);
43 | mCreateBtn = findViewById(R.id.createText);
44 | forgotTextLink = findViewById(R.id.forgotPassword);
45 |
46 |
47 | mLoginBtn.setOnClickListener(new View.OnClickListener() {
48 | @Override
49 | public void onClick(View v) {
50 |
51 | String email = mEmail.getText().toString().trim();
52 | String password = mPassword.getText().toString().trim();
53 |
54 | if(TextUtils.isEmpty(email)){
55 | mEmail.setError("Email is Required.");
56 | return;
57 | }
58 |
59 | if(TextUtils.isEmpty(password)){
60 | mPassword.setError("Password is Required.");
61 | return;
62 | }
63 |
64 | if(password.length() < 6){
65 | mPassword.setError("Password Must be >= 6 Characters");
66 | return;
67 | }
68 |
69 | progressBar.setVisibility(View.VISIBLE);
70 |
71 | // authenticate the user
72 |
73 | fAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener() {
74 | @Override
75 | public void onComplete(@NonNull Task task) {
76 | if(task.isSuccessful()){
77 | Toast.makeText(Login.this, "Logged in Successfully", Toast.LENGTH_SHORT).show();
78 | startActivity(new Intent(getApplicationContext(),MainActivity.class));
79 | }else {
80 | Toast.makeText(Login.this, "Error ! " + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
81 | progressBar.setVisibility(View.GONE);
82 | }
83 |
84 | }
85 | });
86 |
87 | }
88 | });
89 |
90 | mCreateBtn.setOnClickListener(new View.OnClickListener() {
91 | @Override
92 | public void onClick(View v) {
93 | startActivity(new Intent(getApplicationContext(),Register.class));
94 | }
95 | });
96 |
97 | forgotTextLink.setOnClickListener(new View.OnClickListener() {
98 | @Override
99 | public void onClick(View v) {
100 |
101 | final EditText resetMail = new EditText(v.getContext());
102 | final AlertDialog.Builder passwordResetDialog = new AlertDialog.Builder(v.getContext());
103 | passwordResetDialog.setTitle("Reset Password ?");
104 | passwordResetDialog.setMessage("Enter Your Email To Received Reset Link.");
105 | passwordResetDialog.setView(resetMail);
106 |
107 | passwordResetDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
108 | @Override
109 | public void onClick(DialogInterface dialog, int which) {
110 | // extract the email and send reset link
111 | String mail = resetMail.getText().toString();
112 | fAuth.sendPasswordResetEmail(mail).addOnSuccessListener(new OnSuccessListener() {
113 | @Override
114 | public void onSuccess(Void aVoid) {
115 | Toast.makeText(Login.this, "Reset Link Sent To Your Email.", Toast.LENGTH_SHORT).show();
116 | }
117 | }).addOnFailureListener(new OnFailureListener() {
118 | @Override
119 | public void onFailure(@NonNull Exception e) {
120 | Toast.makeText(Login.this, "Error ! Reset Link is Not Sent" + e.getMessage(), Toast.LENGTH_SHORT).show();
121 | }
122 | });
123 |
124 | }
125 | });
126 |
127 | passwordResetDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
128 | @Override
129 | public void onClick(DialogInterface dialog, int which) {
130 | // close the dialog
131 | }
132 | });
133 |
134 | passwordResetDialog.create().show();
135 |
136 | }
137 | });
138 |
139 |
140 | }
141 | }
142 |
--------------------------------------------------------------------------------
/app/src/main/java/net/smallacademy/authenticatorapp/MainActivity.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import androidx.annotation.NonNull;
4 | import androidx.appcompat.app.AlertDialog;
5 | import androidx.appcompat.app.AppCompatActivity;
6 |
7 | import android.app.Activity;
8 | import android.content.ContentResolver;
9 | import android.content.DialogInterface;
10 | import android.content.Intent;
11 | import android.net.Uri;
12 | import android.os.Bundle;
13 | import android.provider.MediaStore;
14 | import android.util.Log;
15 | import android.view.View;
16 | import android.webkit.MimeTypeMap;
17 | import android.widget.Button;
18 | import android.widget.EditText;
19 | import android.widget.ImageView;
20 | import android.widget.TextView;
21 | import android.widget.Toast;
22 |
23 | import com.google.android.gms.tasks.OnFailureListener;
24 | import com.google.android.gms.tasks.OnSuccessListener;
25 | import com.google.firebase.auth.FirebaseAuth;
26 | import com.google.firebase.auth.FirebaseUser;
27 | import com.google.firebase.firestore.DocumentReference;
28 | import com.google.firebase.firestore.DocumentSnapshot;
29 | import com.google.firebase.firestore.EventListener;
30 | import com.google.firebase.firestore.FirebaseFirestore;
31 | import com.google.firebase.firestore.FirebaseFirestoreException;
32 | import com.google.firebase.storage.FirebaseStorage;
33 | import com.google.firebase.storage.StorageReference;
34 | import com.google.firebase.storage.UploadTask;
35 | import com.squareup.picasso.Picasso;
36 |
37 | import javax.annotation.Nullable;
38 |
39 | public class MainActivity extends AppCompatActivity {
40 | private static final int GALLERY_INTENT_CODE = 1023 ;
41 | TextView fullName,email,phone,verifyMsg;
42 | FirebaseAuth fAuth;
43 | FirebaseFirestore fStore;
44 | String userId;
45 | Button resendCode;
46 | Button resetPassLocal,changeProfileImage;
47 | FirebaseUser user;
48 | ImageView profileImage;
49 | StorageReference storageReference;
50 |
51 |
52 | @Override
53 | protected void onCreate(Bundle savedInstanceState) {
54 | super.onCreate(savedInstanceState);
55 | setContentView(R.layout.activity_main);
56 | phone = findViewById(R.id.profilePhone);
57 | fullName = findViewById(R.id.profileName);
58 | email = findViewById(R.id.profileEmail);
59 | resetPassLocal = findViewById(R.id.resetPasswordLocal);
60 |
61 | profileImage = findViewById(R.id.profileImage);
62 | changeProfileImage = findViewById(R.id.changeProfile);
63 |
64 |
65 | fAuth = FirebaseAuth.getInstance();
66 | fStore = FirebaseFirestore.getInstance();
67 | storageReference = FirebaseStorage.getInstance().getReference();
68 |
69 | StorageReference profileRef = storageReference.child("users/"+fAuth.getCurrentUser().getUid()+"/profile.jpg");
70 | profileRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
71 | @Override
72 | public void onSuccess(Uri uri) {
73 | Picasso.get().load(uri).into(profileImage);
74 | }
75 | });
76 |
77 | resendCode = findViewById(R.id.resendCode);
78 | verifyMsg = findViewById(R.id.verifyMsg);
79 |
80 |
81 | userId = fAuth.getCurrentUser().getUid();
82 | user = fAuth.getCurrentUser();
83 |
84 | if(!user.isEmailVerified()){
85 | verifyMsg.setVisibility(View.VISIBLE);
86 | resendCode.setVisibility(View.VISIBLE);
87 |
88 | resendCode.setOnClickListener(new View.OnClickListener() {
89 | @Override
90 | public void onClick(final View v) {
91 |
92 | user.sendEmailVerification().addOnSuccessListener(new OnSuccessListener() {
93 | @Override
94 | public void onSuccess(Void aVoid) {
95 | Toast.makeText(v.getContext(), "Verification Email Has been Sent.", Toast.LENGTH_SHORT).show();
96 | }
97 | }).addOnFailureListener(new OnFailureListener() {
98 | @Override
99 | public void onFailure(@NonNull Exception e) {
100 | Log.d("tag", "onFailure: Email not sent " + e.getMessage());
101 | }
102 | });
103 | }
104 | });
105 | }
106 |
107 |
108 |
109 |
110 | DocumentReference documentReference = fStore.collection("users").document(userId);
111 | documentReference.addSnapshotListener(this, new EventListener() {
112 | @Override
113 | public void onEvent(@Nullable DocumentSnapshot documentSnapshot, @Nullable FirebaseFirestoreException e) {
114 | if(documentSnapshot.exists()){
115 | phone.setText(documentSnapshot.getString("phone"));
116 | fullName.setText(documentSnapshot.getString("fName"));
117 | email.setText(documentSnapshot.getString("email"));
118 |
119 | }else {
120 | Log.d("tag", "onEvent: Document do not exists");
121 | }
122 | }
123 | });
124 |
125 |
126 | resetPassLocal.setOnClickListener(new View.OnClickListener() {
127 | @Override
128 | public void onClick(View v) {
129 |
130 | final EditText resetPassword = new EditText(v.getContext());
131 |
132 | final AlertDialog.Builder passwordResetDialog = new AlertDialog.Builder(v.getContext());
133 | passwordResetDialog.setTitle("Reset Password ?");
134 | passwordResetDialog.setMessage("Enter New Password > 6 Characters long.");
135 | passwordResetDialog.setView(resetPassword);
136 |
137 | passwordResetDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
138 | @Override
139 | public void onClick(DialogInterface dialog, int which) {
140 | // extract the email and send reset link
141 | String newPassword = resetPassword.getText().toString();
142 | user.updatePassword(newPassword).addOnSuccessListener(new OnSuccessListener() {
143 | @Override
144 | public void onSuccess(Void aVoid) {
145 | Toast.makeText(MainActivity.this, "Password Reset Successfully.", Toast.LENGTH_SHORT).show();
146 | }
147 | }).addOnFailureListener(new OnFailureListener() {
148 | @Override
149 | public void onFailure(@NonNull Exception e) {
150 | Toast.makeText(MainActivity.this, "Password Reset Failed.", Toast.LENGTH_SHORT).show();
151 | }
152 | });
153 | }
154 | });
155 |
156 | passwordResetDialog.setNegativeButton("No", new DialogInterface.OnClickListener() {
157 | @Override
158 | public void onClick(DialogInterface dialog, int which) {
159 | // close
160 | }
161 | });
162 |
163 | passwordResetDialog.create().show();
164 |
165 | }
166 | });
167 |
168 | changeProfileImage.setOnClickListener(new View.OnClickListener() {
169 | @Override
170 | public void onClick(View v) {
171 | // open gallery
172 | Intent i = new Intent(v.getContext(),EditProfile.class);
173 | i.putExtra("fullName",fullName.getText().toString());
174 | i.putExtra("email",email.getText().toString());
175 | i.putExtra("phone",phone.getText().toString());
176 | startActivity(i);
177 | //
178 |
179 | }
180 | });
181 |
182 |
183 | }
184 |
185 |
186 |
187 |
188 | public void logout(View view) {
189 | FirebaseAuth.getInstance().signOut();//logout
190 | startActivity(new Intent(getApplicationContext(),Login.class));
191 | finish();
192 | }
193 |
194 |
195 | }
196 |
--------------------------------------------------------------------------------
/app/src/main/java/net/smallacademy/authenticatorapp/Register.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.text.TextUtils;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.widget.Button;
9 | import android.widget.EditText;
10 | import android.widget.ProgressBar;
11 | import android.widget.TextView;
12 | import android.widget.Toast;
13 |
14 | import androidx.annotation.NonNull;
15 | import androidx.appcompat.app.AppCompatActivity;
16 |
17 | import com.google.android.gms.tasks.OnCompleteListener;
18 | import com.google.android.gms.tasks.OnFailureListener;
19 | import com.google.android.gms.tasks.OnSuccessListener;
20 | import com.google.android.gms.tasks.Task;
21 | import com.google.firebase.auth.AuthResult;
22 | import com.google.firebase.auth.FirebaseAuth;
23 | import com.google.firebase.auth.FirebaseUser;
24 | import com.google.firebase.firestore.DocumentReference;
25 | import com.google.firebase.firestore.FirebaseFirestore;
26 |
27 | import java.util.HashMap;
28 | import java.util.Map;
29 |
30 | public class Register extends AppCompatActivity {
31 | public static final String TAG = "TAG";
32 | EditText mFullName,mEmail,mPassword,mPhone;
33 | Button mRegisterBtn;
34 | TextView mLoginBtn;
35 | FirebaseAuth fAuth;
36 | ProgressBar progressBar;
37 | FirebaseFirestore fStore;
38 | String userID;
39 |
40 | @Override
41 | protected void onCreate(Bundle savedInstanceState) {
42 | super.onCreate(savedInstanceState);
43 | setContentView(R.layout.activity_register);
44 |
45 | mFullName = findViewById(R.id.fullName);
46 | mEmail = findViewById(R.id.Email);
47 | mPassword = findViewById(R.id.password);
48 | mPhone = findViewById(R.id.phone);
49 | mRegisterBtn= findViewById(R.id.registerBtn);
50 | mLoginBtn = findViewById(R.id.createText);
51 |
52 | fAuth = FirebaseAuth.getInstance();
53 | fStore = FirebaseFirestore.getInstance();
54 | progressBar = findViewById(R.id.progressBar);
55 |
56 | if(fAuth.getCurrentUser() != null){
57 | startActivity(new Intent(getApplicationContext(),MainActivity.class));
58 | finish();
59 | }
60 |
61 |
62 | mRegisterBtn.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | final String email = mEmail.getText().toString().trim();
66 | String password = mPassword.getText().toString().trim();
67 | final String fullName = mFullName.getText().toString();
68 | final String phone = mPhone.getText().toString();
69 |
70 | if(TextUtils.isEmpty(email)){
71 | mEmail.setError("Email is Required.");
72 | return;
73 | }
74 |
75 | if(TextUtils.isEmpty(password)){
76 | mPassword.setError("Password is Required.");
77 | return;
78 | }
79 |
80 | if(password.length() < 6){
81 | mPassword.setError("Password Must be >= 6 Characters");
82 | return;
83 | }
84 |
85 | progressBar.setVisibility(View.VISIBLE);
86 |
87 | // register the user in firebase
88 |
89 | fAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener() {
90 | @Override
91 | public void onComplete(@NonNull Task task) {
92 | if(task.isSuccessful()){
93 |
94 | // send verification link
95 |
96 | FirebaseUser fuser = fAuth.getCurrentUser();
97 | fuser.sendEmailVerification().addOnSuccessListener(new OnSuccessListener() {
98 | @Override
99 | public void onSuccess(Void aVoid) {
100 | Toast.makeText(Register.this, "Verification Email Has been Sent.", Toast.LENGTH_SHORT).show();
101 | }
102 | }).addOnFailureListener(new OnFailureListener() {
103 | @Override
104 | public void onFailure(@NonNull Exception e) {
105 | Log.d(TAG, "onFailure: Email not sent " + e.getMessage());
106 | }
107 | });
108 |
109 | Toast.makeText(Register.this, "User Created.", Toast.LENGTH_SHORT).show();
110 | userID = fAuth.getCurrentUser().getUid();
111 | DocumentReference documentReference = fStore.collection("users").document(userID);
112 | Map user = new HashMap<>();
113 | user.put("fName",fullName);
114 | user.put("email",email);
115 | user.put("phone",phone);
116 | documentReference.set(user).addOnSuccessListener(new OnSuccessListener() {
117 | @Override
118 | public void onSuccess(Void aVoid) {
119 | Log.d(TAG, "onSuccess: user Profile is created for "+ userID);
120 | }
121 | }).addOnFailureListener(new OnFailureListener() {
122 | @Override
123 | public void onFailure(@NonNull Exception e) {
124 | Log.d(TAG, "onFailure: " + e.toString());
125 | }
126 | });
127 | startActivity(new Intent(getApplicationContext(),MainActivity.class));
128 |
129 | }else {
130 | Toast.makeText(Register.this, "Error ! " + task.getException().getMessage(), Toast.LENGTH_SHORT).show();
131 | progressBar.setVisibility(View.GONE);
132 | }
133 | }
134 | });
135 | }
136 | });
137 |
138 |
139 |
140 | mLoginBtn.setOnClickListener(new View.OnClickListener() {
141 | @Override
142 | public void onClick(View v) {
143 | startActivity(new Intent(getApplicationContext(),Login.class));
144 | }
145 | });
146 |
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_email_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_local_phone_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_person_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/walpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/drawable/walpaper.jpg
--------------------------------------------------------------------------------
/app/src/main/res/font/aclonica.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_edit_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
22 |
23 |
32 |
33 |
46 |
47 |
60 |
61 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
23 |
24 |
36 |
37 |
57 |
58 |
77 |
78 |
91 |
92 |
102 |
103 |
114 |
115 |
127 |
128 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
23 |
24 |
34 |
35 |
48 |
49 |
62 |
63 |
75 |
76 |
91 |
92 |
101 |
102 |
114 |
115 |
125 |
126 |
136 |
137 |
147 |
148 |
157 |
158 |
167 |
168 |
178 |
179 |
191 |
192 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
23 |
24 |
36 |
37 |
57 |
58 |
77 |
78 |
97 |
116 |
117 |
130 |
131 |
141 |
142 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/font_certs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @array/com_google_android_gms_fonts_certs_dev
5 | - @array/com_google_android_gms_fonts_certs_prod
6 |
7 |
8 | -
9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
10 |
11 |
12 |
13 | -
14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/preloaded_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @font/aclonica
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AuthenticatorApp
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/test/java/net/smallacademy/authenticatorapp/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package net.smallacademy.authenticatorapp;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 |
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.6.3'
11 | classpath 'com.google.gms:google-services:4.3.3'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 |
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 |
21 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bikashthapa01/firebase-authentication-android/bfb976bfb09e3e83d8238fe3712b19200eb2486c/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Apr 02 19:34:33 IST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name='AuthenticatorApp'
3 |
--------------------------------------------------------------------------------