Android App Auth Template(Login, Signup and Forgot Password) UI

Related tags

App auth-ui
Overview

auth-ui

Android App Auth(Login, Signup and Forgot Password) UI

Download License TravisCI API Say Thanks!

You can find Kotlin Version for this library here

What's in the box

  • The login, signup and forgot password UI Template for your app
  • Easy way to implement
  • Play with element visibility
  • Setup material theme like Teal, Cyan, Indigo and many more.
  • Hide and Show social logins.
Basic Form Signup without Social Platforms Login without Social Platforms

Themes

CYAN TEAL WHITE/DEFAULT

Setup

1. Include in your project

Using Gradle

The Auth UI library is pushed to jcenter, so you need to add the following dependency to your app's build.gradle.

compile 'com.sayagodshala:auth-ui:1.0'

As a module

If you can't include it as gradle dependency, you can also download this GitHub repo and copy the auth-ui folder to your project.

2. Usage

First step in configuring the Auth UI Framework is to place FrameLayout Container in your layout.

<FrameLayout
        android:id="@+id/frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

Next step is to configure the AuthUISettings.

Example:

AuthUISettings authUISettings = new AuthUISettings();
authUISettings.setSocialPlatformRequired(true);
authUISettings.setAppLogoRequired(true);
authUISettings.setTermsRequired(true);
authUISettings.setSignupRequired(true);
authUISettings.setFacebookLoginRequired(true);
authUISettings.setGoogleLoginRequired(true);
authUISettings.setForgotPasswordRequired(true);
authUISettings.setAppLogo(R.mipmap.my_logo);
authUISettings.setLoginTitle("Login using your registered email and password.");
authUISettings.setSignupTitle("You are just few steps a head. Register and start a head.");
authUISettings.setForgotPasswordTitle("Put in your email id for password reset link");
authUISettings.setLoginTerms("By Logging in I agree to the <b>Terms of Use</b>");
authUISettings.setSignupTerms("By Signing up I agree to the <b>Terms of Use</b>");
authUISettings.setFacebookLoginTitle("Login with Facebook");
authUISettings.setFacebookSignupTitle("Signup with Facebook");
authUISettings.setGoogleLoginTitle("Login with Google");
authUISettings.setGoogleSignupTitle("Signup with Google");
authUISettings.setLoginToggleTitle("Have an account? <b>LOGIN</b>");
authUISettings.setSignupToggleTitle("Don\'t have an account? <b>SIGN UP</b>");
authUISettings.setDefaultView(AuthUIView.LOGIN);
authUISettings.setMaterialTheme(MaterialTheme.CYAN);

Next step is to load the AuthUIFragment in your Activity.

// declare instance of AuthUIFragment
AuthUIFragment authUIFragment;
// load fragment with your own settings or default settings
authUIFragment = AuthUIFragment.newInstance(authUISettings);
**OR**
authUIFragment = AuthUIFragment.newInstanceWithDefaultSettings();

// load authUIFragment into the frame layout
AuthUIFragment.loadFragment(this, authUIFragment, R.id.frame);


Final step is to implement AuthUIFragment.AuthUIFragmentListener interface in your target activity where AuthUIFragment is loaded with corresponding methods.

public class LoginActivity extends AppCompatActivity implements AuthUIFragmentListener {

    @Override
    public void onLoginClicked(AuthUIUser user) {
        switch (user.getLoginType()) {
            case EMAIL:
                Log.d("onLoginClicked", "email : " + user.getEmail() + ", password : " + user.getPassword());
                break;
            case MOBILE:
                Log.d("onLoginClicked", "mobile : " + user.getMobile() + ", password : " + user.getPassword());
                break;
            case EMAIL_OR_MOBILE:
                Log.d("onLoginClicked", "email/mobile : " + user.getEmailOrMobile() + ", password : " + user.getPassword());
                break;
        }
    }

    @Override
    public void onSignupClicked(AuthUIUser user) {
        Log.d("onSignupClicked", "name : " + user.getName() + ", email : " + user.getEmail() + ", mobile : " + user.getMobile() + ", password : " + user.getPassword());
    }

    @Override
    public void onForgotPasswordClicked(AuthUIUser user) {
        Log.d("onForgotPasswordClicked", "email : " + user.getEmail());
        // on successful response of 'forgot password api' call below method to show login view again
        authUIFragment.recallLoginView();
    }

    @Override
    public void onSocialAccountClicked(SocialAccount socialAccount, boolean isRegistration) {
        Log.d("onSocialAccountClicked", "socialAccount : " + socialAccount.name() + ", isRegistration : " + isRegistration);
        switch (socialAccount) {
            case FACEBOOK:
                break;
            case GOOGLE:
                break;
        }
    }

    @Override
    public void onFormValidationError(String error) {
        Log.d("onFormValidationError", "error : " + error);
    }

}

This is the simplest way to configure the library to enable Custom login mode along with Social Platform login modes.

That's it!

More about AuthUISettings

Login Types(EMAIL,MOBILE and EMAIL_OR_MOBILE). Default login type is EMAIL.

authUISettings.setLoginType(LoginType.EMAIL);
**OR**
authUISettings.setLoginType(LoginType.MOBILE);
**OR**
authUISettings.setLoginType(LoginType.EMAIL_OR_MOBILE);

To hide social platforms use below code

authUISettings.setSocialPlatformRequired(false);

To hide App logo

authUISettings.setAppLogoRequired(false);

In case your app only requires login

authUISettings.setSignupRequired(false);

In case your app only requires one of the below

authUISettings.setFacebookLoginRequired(false);
**OR**
authUISettings.setGoogleLoginRequired(false);

In case you want to handle the form validation error message

authUISettings.setHandleFormError(true);
// once it is set to true, implement your logic in 'onFormValidationError(String message)' method of AuthUIFragmentListener interface

In case your app doesn't require forgot password

authUISettings.setForgotPasswordRequired(true);

Set your default view

authUISettings.setDefaultView(AuthUIView.LOGIN);
**OR**
authUISettings.setDefaultView(AuthUIView.SIGNUP);

Supported Themes (Default Theme is WHITE)

authUISettings.setMaterialTheme(MaterialTheme.DEFAULT);
**OR**
authUISettings.setMaterialTheme(MaterialTheme.WHITE);
**OR**
authUISettings.setMaterialTheme(MaterialTheme.RED);

and many more like PINK,PURPLE,DEEP_PURPLE,INDIGO,BLUE,LIGHT_BLUE,CYAN,TEAL,BLUE_GREY,YELLOW,AMBER,BROWN,GREEN and GREY.

Included Libraries

The following third-party libraries were used in this framework.

  • GSON library

Contribution

All contributions are welcome. Encounter any issue? Don't hesitate to open an issue

Convention: Master branch would be the development branch. So feel free to fork from the Master branch.

License

Copyright 2017 Codelight Studios

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
KotlinSample - Template project for building a GTK3 Kotlin/Native app against the elementary Flatpak runtime

GTK3 Kotlin/Native Sample This is a working example of how to write and build a

Get a libGDX-powered Android live wallpaper up and running quickly with this project template

This project is a libGDX Android live wallpaper template. It's the demo application created by the libGDX code generator, remade as a live wallpaper.

A template for Advent of Code challenge with input downloading and prepared test classes
A template for Advent of Code challenge with input downloading and prepared test classes

Advent of Code Kotlin Template A template which will help you concentrate on the puzzle solutions. It brings Downloading and caching of the puzzle inp

Zakadabar Application Template

Zakadabar Application Template This repository contains an application template which you may use to start a new application project based on Zakadaba

Advent of Code template project for Kotlin

Advent of Code Kotlin Template Advent of Code – an annual event in December since 2015. Every year since then, with the first day of December, a progr

Tkhwang advent of code kotlin template

tkhwang-advent-of-code-kotlin-template Welcome to the Advent of Code1 Kotlin pro

A Kotlin/JVM Project Template with Gradle

kotlin-project-template A Kotlin/JVM Project Template with Gradle. Clone or npx

Udacity-shoestore - A template provided for use when building your README file for students

README Template Below is a template provided for use when building your README f

Poc-sealed-secrets - An alternative to store sensitive data in the template Secrets Kubernetes an encrypted way

POC Sealed Secrets Overview Proof of concept with the objective of showing an al

Comments
  • FB Auth

    FB Auth

    how would you go about using the onSocialAccountClicked to authenticate with such social account.

    i want to create a call back but without access to the fb button i am unable to do so

    opened by bryanperez43 0
Owner
Saya Godshala
Android Studio, Java, Kotlin, Continuos Integration, Bintray and Android Library.
Saya Godshala
Text to Speech Project for Spring Boot and Kotlin, Auth Server, Python with Fast API (gTTS)

TTS-App Text to Speech Project for Spring Boot and Kotlin, Auth Server, Python with Fast API (gTTS) Python의 gTTS lib를 활용하여 텍스트를 음성으로 변환하는 서비스를 구현해봅니다.

Seokhyun 7 Jan 7, 2022
Burp extension to scan Log4Shell (CVE-2021-44228) vulnerability pre and post auth

Log4J Scanner Burp extension to scan Log4Shell (CVE-2021-44228) vulnerability pre and post auth. Disclaimer I am not responsible for your actions, bur

Dexter0us 94 Nov 22, 2022
Android-Java-App - Notepad app with user and password. SQL Lite

DVNote2 App Android-Java-App Notepad app with user and password Application made in Android Studio with Java language and SQLite database. How does it

DViga 1 Nov 6, 2021
You can store all your password, bank details, card details in one place and remember only one master PIN. The application works totally offline.

Keep Password An application where you can store all your password, bank details, card details in one place and remember only one master PIN. The appl

rıdvan 4 Apr 18, 2022
Duress password trigger.

Duress Duress password trigger. Tiny app to listen for a duress password on the lockscreen. When found, it will send a broadcast message to the select

lucky 194 Jan 1, 2023
A simple login and logout Android application written in Kotlin

A simple login and logout Android application written in Kotlin. It authorizes user using an api and shows profile screen.

Emre Uysal 4 Aug 2, 2022
Projeto de Prova Semestral. Aplicativo Android com login e registro utilizando Firebase Authentication e consumo de API com Retrofit.

Ocean-Tech-Android Projeto de Prova Semestral. Aplicativo Android com login e cadastro utilizando Firebase Authentication e consumo de API com Retrofi

Marcos Lopes da Silva Junior 0 Nov 28, 2021
FirebaseAuthentication - Login/Register Android Application using Firebase Authentication

FireBaseAuthentication This is a Firebase Authentication Application which will

Akshat Bhuhagal 6 Nov 27, 2022
Amazing Material Login effect

MaterialLogin The Animation effect: You can download the source code. Problems can give me a message, thank you! License Copyright 2016 fanrunqi Licen

leo 1.9k Dec 30, 2022