From b51e89a2e1ed50448bd80f91b2a7785c6fe88fef Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas.leder@jobrouter.com>
Date: Tue, 1 Mar 2022 11:37:48 +0100
Subject: [PATCH] remove seperate login page (return 404 if login is not set)

---
 app/login.py                               |  4 +-
 app/static/socialSignin/css/buttons-si.css | 48 ----------------------
 app/static/socialSignin/img/github.svg     | 38 -----------------
 app/static/socialSignin/img/google.svg     | 23 -----------
 app/templates/login.html                   | 24 -----------
 5 files changed, 2 insertions(+), 135 deletions(-)
 delete mode 100644 app/static/socialSignin/css/buttons-si.css
 delete mode 100644 app/static/socialSignin/img/github.svg
 delete mode 100644 app/static/socialSignin/img/google.svg
 delete mode 100644 app/templates/login.html

diff --git a/app/login.py b/app/login.py
index bd6aef8..cafbe50 100644
--- a/app/login.py
+++ b/app/login.py
@@ -1,12 +1,12 @@
 #!/usr/bin/env python3
-from flask import redirect, render_template
+from flask import redirect, abort
 
 def login(request, GITHUB_CLIENT_ID, cookieNotice, GOOGLE_CLIENT_ID, url_scheme, domain):
     "Thif function handles the redirect for the oauth pages"
     service = request.args.get("service")
     if(service == "github"): return redirect("https://github.com/login/oauth/authorize/?client_id=" + GITHUB_CLIENT_ID + "&scope=user") #redirect the user to the github login page and ask for access to user data (name, email, ...)
     if(service == "google"): return redirect("https://accounts.google.com/o/oauth2/v2/auth?client_id=" + GOOGLE_CLIENT_ID + "&scope=profile%20email%20openid&response_type=code&access_type=offline&include_granted_scopes=true&redirect_uri=" + url_scheme + "://" + domain[0] + "/user/google-callback")
-    return render_template("login.html", cookieNotice=cookieNotice)
+    abort(404)
     
 if (__name__ == "__main__"):
     print("This file is not made for direct call, please run the main.py")
diff --git a/app/static/socialSignin/css/buttons-si.css b/app/static/socialSignin/css/buttons-si.css
deleted file mode 100644
index 8392cb1..0000000
--- a/app/static/socialSignin/css/buttons-si.css
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Social Buttons Style */
-.btn-si {
-  background-position: 1em;
-  background-repeat: no-repeat;
-  background-size: 2em;
-  border-radius: 0.5em;
-  border: none;
-  color: white;
-  cursor: pointer;
-  font-size: 1em;
-  height: 4em;
-  line-height: 1em;
-  padding: 0 2em 0 4em;
-  text-decoration: none;
-  transition: all 0.5s; }
-
-.btn-google {
-  background-color: #dd4b39;
-  background-image: url("../img/google.svg"); }
-  .btn-google:hover {
-    background-color: #e47365; }
-  .btn-google:active {
-    background-color: #c23321; }
-
-.btn-github {
-  background-color: #2a2a2a;
-  background-image: url("../img/github.svg"); }
-  .btn-github:hover {
-    background-color: #444444; }
-  .btn-github:active {
-    background-color: #101010; }
-
-.btn-si-a {
-  padding: 25px 15px 25px 65px !important;
-  font-family: arial; 
-  color : white;}
-
-.smaller .btn-si-a {
-  padding-left: 40px !important;
-  font-size: 12px; }
-
-.box{ clear: both; }
-.box-a li{
-	float: left;
-	margin: 30px 0px;
-}
-
-#noDot { list-style-type: none;}
\ No newline at end of file
diff --git a/app/static/socialSignin/img/github.svg b/app/static/socialSignin/img/github.svg
deleted file mode 100644
index b332fc7..0000000
--- a/app/static/socialSignin/img/github.svg
+++ /dev/null
@@ -1,38 +0,0 @@
-<svg width="155" height="155" xmlns="http://www.w3.org/2000/svg">
- <metadata id="metadata8">image/svg+xml</metadata>
- <defs>
-  <clipPath id="clipPath16">
-   <path d="m-288.200012,331.985962l530.973022,0l0,-275.985962l-530.973022,0l0,275.985962z" id="path18"/>
-  </clipPath>
- </defs>
-  <g transform="matrix(1.25 0 0 -1.25 0 344.983)" id="g10">
-   <g id="g12">
-    <g clip-path="url(#clipPath16)" id="g14">
-     <g id="g24">
-      <path d="m62.40889,273.554718c-33.347019,0 -60.388,-27.035019 -60.388,-60.388016c0,-26.679993 17.303001,-49.315994 41.296989,-57.30101c3.018013,-0.55899 4.126011,1.310013 4.126011,2.905014c0,1.438995 -0.056,6.197006 -0.082001,11.242996c-16.79999,-3.653 -20.344999,7.125 -20.344999,7.125c-2.747009,6.979004 -6.70499,8.835999 -6.70499,8.835999c-5.478999,3.748001 0.412991,3.671005 0.412991,3.671005c6.064001,-0.42601 9.25699,-6.224014 9.25699,-6.224014c5.386021,-9.230988 14.127018,-6.561981 17.572998,-5.018997c0.541992,3.902008 2.107002,6.567001 3.834023,8.075012c-13.413033,1.525986 -27.513,6.705002 -27.513,29.843994c0,6.591995 2.358971,11.979996 6.221979,16.209c-0.62698,1.521011 -2.694,7.662994 0.584991,15.981003c0,0 5.07202,1.621994 16.611021,-6.190994c4.81699,1.337997 9.983009,2.008987 15.114986,2.03299c5.132,-0.024002 10.302013,-0.694992 15.128002,-2.03299c11.526001,7.812988 16.589996,6.190994 16.589996,6.190994c3.28701,-8.318008 1.220001,-14.459991 0.59301,-15.981003c3.871986,-4.229004 6.213997,-9.617004 6.213997,-16.209c0,-23.195007 -14.126984,-28.300995 -27.574005,-29.796005c2.166008,-1.873993 4.096008,-5.548996 4.096008,-11.182999c0,-8.079987 -0.069,-14.582993 -0.069,-16.571991c0,-1.608002 1.085991,-3.490005 4.147003,-2.89801c23.980988,7.994003 41.263,30.622009 41.263,57.294006c0,33.352997 -27.036987,60.388016 -60.388012,60.388016" id="path26" fill-rule="evenodd" fill="#ffffff"/>
-     </g>
-     <g id="g28">
-      <path d="m24.89329,186.851593c-0.13299,-0.300995 -0.605009,-0.391006 -1.035,-0.184998c-0.438999,0.197998 -0.68399,0.606995 -0.54199,0.908005c0.130001,0.307999 0.60199,0.393997 1.040001,0.187988c0.43799,-0.196991 0.68799,-0.610001 0.536989,-0.910995" id="path30" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g32">
-      <path d="m27.339609,184.123001c-0.287989,-0.266998 -0.85199,-0.143005 -1.233,0.279007c-0.396,0.42099 -0.468988,0.985001 -0.177,1.25499c0.296991,0.266998 0.843021,0.141998 1.238001,-0.278992c0.396,-0.42601 0.473,-0.984009 0.171999,-1.255005" id="path34" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g36">
-      <path d="m29.720409,180.645493c-0.369999,-0.257996 -0.976009,-0.016998 -1.35001,0.521011c-0.369989,0.537003 -0.369989,1.181 0.00901,1.438995c0.373991,0.258011 0.971001,0.025009 1.35,-0.506989c0.36899,-0.546005 0.36899,-1.190018 -0.009001,-1.453018" id="path38" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g40">
-      <path d="m32.982101,177.285202c-0.331001,-0.365005 -1.036011,-0.266998 -1.552002,0.231003c-0.52799,0.487 -0.67499,1.177994 -0.344,1.542999c0.336,0.365997 1.044981,0.263 1.565001,-0.231003c0.523991,-0.486008 0.68399,-1.182007 0.331001,-1.542999" id="path42" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g44">
-      <path d="m37.482101,175.334c-0.146,-0.472992 -0.825012,-0.686996 -1.50901,-0.485992c-0.68298,0.207001 -1.130001,0.759995 -0.992001,1.237991c0.141998,0.477005 0.824009,0.699997 1.513,0.485001c0.682011,-0.206009 1.130009,-0.755997 0.98801,-1.237" id="path46" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g48">
-      <path d="m42.424511,174.972702c0.016998,-0.498001 -0.562992,-0.911011 -1.28101,-0.919998c-0.721981,-0.016998 -1.307003,0.387009 -1.315002,0.876999c0,0.502991 0.568001,0.911011 1.289001,0.923996c0.718021,0.014008 1.307011,-0.386993 1.307011,-0.880997" id="path50" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-     <g id="g52">
-      <path d="m47.023109,175.754898c0.086002,-0.485001 -0.412991,-0.984009 -1.125999,-1.117004c-0.700989,-0.128998 -1.35001,0.171997 -1.438999,0.653015c-0.087002,0.497986 0.42001,0.996994 1.120998,1.125992c0.713989,0.124008 1.353001,-0.167999 1.444,-0.662003" id="path54" fill-rule="nonzero" fill="#ffffff"/>
-     </g>
-    </g>
-   </g>
-  </g>
-</svg>
\ No newline at end of file
diff --git a/app/static/socialSignin/img/google.svg b/app/static/socialSignin/img/google.svg
deleted file mode 100644
index 61b41af..0000000
--- a/app/static/socialSignin/img/google.svg
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
-	 width="35px" height="35px" viewBox="10 10 110.658 110.646" enable-background="new 0 0 134.658 131.646"
-	 xml:space="preserve">
-<g>
-	<g>
-		<path fill="#FFFFFF" d="M70.479,71.845l-3.983-3.093c-1.213-1.006-2.872-2.334-2.872-4.765c0-2.441,1.659-3.993,3.099-5.43
-			c4.64-3.652,9.276-7.539,9.276-15.73c0-8.423-5.3-12.854-7.84-14.956h6.849l7.189-4.517H60.418
-			c-5.976,0-14.588,1.414-20.893,6.619c-4.752,4.1-7.07,9.753-7.07,14.842c0,8.639,6.633,17.396,18.346,17.396
-			c1.106,0,2.316-0.109,3.534-0.222c-0.547,1.331-1.1,2.439-1.1,4.32c0,3.431,1.763,5.535,3.317,7.528
-			c-4.977,0.342-14.268,0.893-21.117,5.103c-6.523,3.879-8.508,9.525-8.508,13.51c0,8.202,7.731,15.842,23.762,15.842
-			c19.01,0,29.074-10.519,29.074-20.932C79.764,79.709,75.344,75.943,70.479,71.845z M56,59.107
-			c-9.51,0-13.818-12.294-13.818-19.712c0-2.888,0.547-5.87,2.428-8.199c1.773-2.218,4.861-3.657,7.744-3.657
-			c9.168,0,13.923,12.404,13.923,20.382c0,1.996-0.22,5.533-2.762,8.09C61.737,57.785,58.762,59.107,56,59.107z M56.109,103.65
-			c-11.826,0-19.452-5.657-19.452-13.523c0-7.864,7.071-10.524,9.504-11.405c4.64-1.561,10.611-1.779,11.607-1.779
-			c1.105,0,1.658,0,2.538,0.111c8.407,5.983,12.056,8.965,12.056,14.629C72.362,98.542,66.723,103.65,56.109,103.65z"/>
-		<polygon fill="#FFFFFF" points="98.393,58.938 98.393,47.863 92.923,47.863 92.923,58.938 81.866,58.938 81.866,64.469
-			92.923,64.469 92.923,75.612 98.393,75.612 98.393,64.469 109.506,64.469 109.506,58.938 		"/>
-	</g>
-</g>
-</svg>
diff --git a/app/templates/login.html b/app/templates/login.html
deleted file mode 100644
index 3f74f4f..0000000
--- a/app/templates/login.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-   <head>
-        <link href="/static/style.css" rel="stylesheet">
-        <link href="/static/font.css" rel="stylesheet">
-        <link href="/static/darkmode.css" rel="stylesheet">
-        <link href="/static/socialSignin/css/buttons-si.css" rel="stylesheet">
-        {% if cookieNotice %}
-        <script type="text/javascript" id="cookieinfo" src="/static/cookieinfo.js" ></script>
-        {% endif %}
-        <title>URL shorter</title>
-   </head>
-
-   <body>
-      <div class="login-page">
-         <div class="form">
-            <div class="box box-a">
-               <a class="btn-si btn-si-a btn-github" style="color: white;" href="/user/login?service=github">Sign in with GitHub </a><br><br><br><br>
-               <a class="btn-si btn-si-a btn-google" style="color: white;"href="/user/login?service=google">Sign in with Google</a>
-           </div>
-         </div>
-      </div>
-   </body>
-</html>
\ No newline at end of file
-- 
GitLab