Commit 439eef59 authored by Sajal Narang's avatar Sajal Narang Committed by GitHub

Merge pull request #161 from pulsejet/ssologin

Use SSO for login with SSL checks
parents abb6aa1e 60c07bae
...@@ -55,6 +55,7 @@ import app.insti.fragment.QuickLinksFragment; ...@@ -55,6 +55,7 @@ import app.insti.fragment.QuickLinksFragment;
import app.insti.fragment.SettingsFragment; import app.insti.fragment.SettingsFragment;
import app.insti.fragment.TrainingBlogFragment; import app.insti.fragment.TrainingBlogFragment;
import app.insti.notifications.NotificationEventReceiver; import app.insti.notifications.NotificationEventReceiver;
import okhttp3.OkHttpClient;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
...@@ -426,7 +427,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On ...@@ -426,7 +427,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
public void initPicasso() { public void initPicasso() {
Picasso.Builder builder = new Picasso.Builder(getApplicationContext()); Picasso.Builder builder = new Picasso.Builder(getApplicationContext());
builder.downloader(new com.squareup.picasso.OkHttp3Downloader(( builder.downloader(new com.squareup.picasso.OkHttp3Downloader((
UnsafeOkHttpClient.getUnsafeOkHttpClient(getApplicationContext()) new OkHttpClient.Builder().build()
))); )));
Picasso built = builder.build(); Picasso built = builder.build();
built.setIndicatorsEnabled(false); built.setIndicatorsEnabled(false);
......
...@@ -28,6 +28,9 @@ public interface RetrofitInterface { ...@@ -28,6 +28,9 @@ public interface RetrofitInterface {
@GET("login") @GET("login")
Call<LoginResponse> login(@Query("code") String AUTH_CODE, @Query("redir") String redirectURI, @Query("fcm_id") String fcmID); Call<LoginResponse> login(@Query("code") String AUTH_CODE, @Query("redir") String redirectURI, @Query("fcm_id") String fcmID);
@GET("login")
Call<LoginResponse> login(@Query("code") String AUTH_CODE, @Query("redir") String redirectURI);
@GET("pass-login") @GET("pass-login")
Call<LoginResponse> passwordLogin(@Query("username") String username, @Query("password") String password); Call<LoginResponse> passwordLogin(@Query("username") String username, @Query("password") String password);
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout <WebView
android:id="@+id/login_webview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:focusable="true" android:layout_alignParentBottom="true"
android:focusableInTouchMode="true" android:layout_alignParentLeft="true"
android:orientation="vertical"> android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="false"
<LinearLayout android:layout_alignWithParentIfMissing="false">
android:layout_width="match_parent" </WebView>
android:layout_height="wrap_content"
android:orientation="vertical"> </LinearLayout>
\ No newline at end of file
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="20dp"
android:contentDescription="InstiApp"
android:paddingLeft="100dp"
android:paddingRight="100dp"
android:scaleType="fitEnd"
app:srcCompat="@drawable/lotus" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="InstiApp"
android:textAlignment="center"
android:textSize="28sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:orientation="vertical"
android:padding="20dp">
<android.support.design.widget.TextInputLayout
android:id="@+id/login_username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="LDAP ID"
android:inputType="text" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="@+id/login_password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:errorEnabled="true"
app:passwordToggleEnabled="true">
<android.support.design.widget.TextInputEditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/login_button"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Log In"
android:textColor="@color/primaryTextColor" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="or"
android:textAlignment="center" />
<TextView
android:id="@+id/login_guest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:text="Continue as a Guest"
android:textAlignment="center"
android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Light.SearchResult.Subtitle" />
</LinearLayout>
</LinearLayout>
</ScrollView>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment