Fix login logos

This commit is contained in:
Chris Jean-Marie 2022-09-28 19:48:44 +00:00
parent 42fb24d9a0
commit 800154dae9
8 changed files with 187 additions and 16 deletions

97
Cargo.lock generated
View File

@ -2,6 +2,27 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "adler"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "alloc-no-stdlib"
version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
[[package]]
name = "alloc-stdlib"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"
dependencies = [
"alloc-no-stdlib",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
@ -77,6 +98,20 @@ dependencies = [
"toml",
]
[[package]]
name = "async-compression"
version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "345fd392ab01f746c717b1357165b76f0b67a60192007b234058c9045fdcf695"
dependencies = [
"brotli",
"flate2",
"futures-core",
"memchr",
"pin-project-lite",
"tokio",
]
[[package]]
name = "async-lock"
version = "2.5.0"
@ -226,6 +261,27 @@ dependencies = [
"generic-array",
]
[[package]]
name = "brotli"
version = "3.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
"brotli-decompressor",
]
[[package]]
name = "brotli-decompressor"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80"
dependencies = [
"alloc-no-stdlib",
"alloc-stdlib",
]
[[package]]
name = "bumpalo"
version = "3.9.1"
@ -284,6 +340,15 @@ dependencies = [
"libc",
]
[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if 1.0.0",
]
[[package]]
name = "crypto-common"
version = "0.1.3"
@ -348,6 +413,16 @@ version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
[[package]]
name = "flate2"
version = "1.0.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"
dependencies = [
"crc32fast",
"miniz_oxide",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -614,6 +689,15 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"
[[package]]
name = "iri-string"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f0f7638c1e223529f1bfdc48c8b133b9e0b434094d1d28473161ee48b235f78"
dependencies = [
"nom",
]
[[package]]
name = "itoa"
version = "1.0.1"
@ -728,6 +812,15 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
dependencies = [
"adler",
]
[[package]]
name = "mio"
version = "0.8.0"
@ -1365,6 +1458,8 @@ version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c530c8675c1dbf98facee631536fa116b5fb6382d7dd6dc1b118d970eafe3ba"
dependencies = [
"async-compression",
"base64",
"bitflags",
"bytes",
"futures-core",
@ -1373,6 +1468,7 @@ dependencies = [
"http-body",
"http-range-header",
"httpdate",
"iri-string",
"mime",
"mime_guess",
"percent-encoding",
@ -1383,6 +1479,7 @@ dependencies = [
"tower-layer",
"tower-service",
"tracing",
"uuid",
]
[[package]]

View File

@ -19,4 +19,4 @@ oauth2 = "4.1"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "json"] }
headers = "0.3"
http = "0.2"
tower-http = { version = "0.3.4", features = ["fs", "trace"] }
tower-http = { version = "0.3.4", features = ["full"] }

0
src/db.rs Normal file
View File

View File

@ -12,12 +12,14 @@ use axum::{
header::SET_COOKIE,
header::{HeaderMap, HeaderValue},
StatusCode,
Request,
Uri
},
response::{Html, IntoResponse, Redirect, Response},
routing::{get, get_service},
Router,
Router, body::{BoxBody, boxed},
};
use http::header;
use http::{header};
use oauth2::{
basic::BasicClient, reqwest::async_http_client, AuthUrl, AuthorizationCode, ClientId,
PkceCodeChallenge, RedirectUrl, Scope, TokenUrl,
@ -25,7 +27,7 @@ use oauth2::{
};
use serde::{Deserialize, Serialize};
use std::{env, net::SocketAddr, collections::HashMap};
use tower_http::{services::ServeDir};
use tower_http::services::ServeDir;
use uuid::Uuid;
const COOKIE_NAME: &str = "SESSION";
@ -58,11 +60,16 @@ async fn main() {
// Get the client structures
let facebook_oauth_client = facebook_oauth_client();
let discord_oauth_client = discord_oauth_client();
let google_oauth_client = google_oauth_client();
// Get oauth clients for the hashmap
//oauth_clients.insert("Google".to_string(), google_oauth_client);
oauth_clients.insert("Facebook", facebook_oauth_client);
oauth_clients.insert("Discord", discord_oauth_client);
oauth_clients.insert("Google", google_oauth_client);
//Static files are served from here
let service = ServeDir::new("templates");
// build our application with a route
let app = Router::new()
@ -85,7 +92,7 @@ async fn main() {
.route("/google_auth", get(google_auth))
.route("/facebook_auth", get(facebook_auth))
.route("/discord_auth", get(discord_auth))
.route("/auth/callback", get(google_authorized))
.route("/auth/google", get(google_authorized))
.route("/auth/facebook", get(facebook_authorized))
.route("/auth/discord", get(discord_authorized))
.layer(Extension(store))
@ -365,7 +372,7 @@ async fn facebook_auth() -> impl IntoResponse {
.url();
// Redirect to Google's oauth service
Redirect::to(auth_url.to_string().parse().unwrap())
Redirect::to(&auth_url.to_string())
}
async fn discord_auth() -> impl IntoResponse {
@ -489,11 +496,11 @@ async fn facebook_authorized(
let mut headers = HeaderMap::new();
headers.insert(SET_COOKIE, cookie.parse().unwrap());
(headers, Redirect::to("/dashboard".parse().unwrap()))
(headers, Redirect::to(&"/dashboard"))
} else {
let mut headers = HeaderMap::new();
(headers, Redirect::to("/".parse().unwrap()))
(headers, Redirect::to(&"/"))
}
}

View File

@ -0,0 +1,26 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48">
<defs>
<linearGradient id="linearGradient3764" x1="1" x2="47" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0,-1,1,0,-1.5e-6,47.999998)">
<stop style="stop-color:#627ad6;stop-opacity:1"/>
<stop offset="1" style="stop-color:#7287da;stop-opacity:1"/>
</linearGradient>
</defs>
<g>
<path d="m 36.31 5 c 5.859 4.062 9.688 10.831 9.688 18.5 c 0 12.426 -10.07 22.5 -22.5 22.5 c -7.669 0 -14.438 -3.828 -18.5 -9.688 c 1.037 1.822 2.306 3.499 3.781 4.969 c 4.085 3.712 9.514 5.969 15.469 5.969 c 12.703 0 23 -10.298 23 -23 c 0 -5.954 -2.256 -11.384 -5.969 -15.469 c -1.469 -1.475 -3.147 -2.744 -4.969 -3.781 z m 4.969 3.781 c 3.854 4.113 6.219 9.637 6.219 15.719 c 0 12.703 -10.297 23 -23 23 c -6.081 0 -11.606 -2.364 -15.719 -6.219 c 4.16 4.144 9.883 6.719 16.219 6.719 c 12.703 0 23 -10.298 23 -23 c 0 -6.335 -2.575 -12.06 -6.719 -16.219 z" style="opacity:0.05"/>
<path d="m 41.28 8.781 c 3.712 4.085 5.969 9.514 5.969 15.469 c 0 12.703 -10.297 23 -23 23 c -5.954 0 -11.384 -2.256 -15.469 -5.969 c 4.113 3.854 9.637 6.219 15.719 6.219 c 12.703 0 23 -10.298 23 -23 c 0 -6.081 -2.364 -11.606 -6.219 -15.719 z" style="opacity:0.1"/>
<path d="m 31.25 2.375 c 8.615 3.154 14.75 11.417 14.75 21.13 c 0 12.426 -10.07 22.5 -22.5 22.5 c -9.708 0 -17.971 -6.135 -21.12 -14.75 a 23 23 0 0 0 44.875 -7 a 23 23 0 0 0 -16 -21.875 z" style="opacity:0.2"/>
</g>
<g>
<path d="m 24 1 c 12.703 0 23 10.297 23 23 c 0 12.703 -10.297 23 -23 23 -12.703 0 -23 -10.297 -23 -23 0 -12.703 10.297 -23 23 -23 z" style="fill:url(#linearGradient3764);fill-opacity:1"/>
</g>
<g>
<g>
<!-- color: #5f9af3 -->
</g>
</g>
<g>
<path d="m 40.03 7.531 c 3.712 4.084 5.969 9.514 5.969 15.469 0 12.703 -10.297 23 -23 23 c -5.954 0 -11.384 -2.256 -15.469 -5.969 4.178 4.291 10.01 6.969 16.469 6.969 c 12.703 0 23 -10.298 23 -23 0 -6.462 -2.677 -12.291 -6.969 -16.469 z" style="opacity:0.1"/>
</g>
<path d="m 21.461 15.651 c 0 0 -3.05 -0.067 -6.256 2.338 0 0 -3.205 5.811 -3.205 12.979 0 0 1.869 3.227 6.789 3.383 0 0 0.825 -1 1.492 -1.846 -2.827 -0.846 -3.895 -2.627 -3.895 -2.627 0.345 0.228 0.565 0.356 0.912 0.557 0.553 0.319 1.113 0.556 1.625 0.756 0.913 0.356 1.998 0.718 3.27 0.959 1.669 0.316 3.626 0.409 5.766 0.02 1.044 -0.19 2.116 -0.489 3.229 -0.957 0.779 -0.289 1.646 -0.713 2.559 -1.314 0 0 -1.111 1.826 -4.03 2.65 0.668 0.846 1.469 1.803 1.469 1.803 c 4.925 -0.159 6.814 -3.383 6.814 -3.383 c 0 -7.168 -3.205 -12.979 -3.205 -12.979 -3.206 -2.404 -6.256 -2.338 -6.256 -2.338 l -0.311 0.357 c 3.784 1.158 5.543 2.826 5.543 2.826 -2.315 -1.269 -4.583 -1.918 -6.701 -2.137 -1.703 -0.176 -3.365 -0.08 -4.875 0.09 -0.777 0.087 -2.671 0.356 -5.05 1.402 -0.824 0.378 -1.313 0.645 -1.313 0.645 0 0 1.847 -1.758 5.854 -2.916 l -0.223 -0.268 m -0.713 8.35 c 1.243 0 2.25 1.119 2.25 2.5 0 1.381 -1.01 2.5 -2.25 2.5 -1.243 0 -2.25 -1.119 -2.25 -2.5 0 -1.381 1.01 -2.5 2.25 -2.5 z m 8.5 0 c 1.243 0 2.25 1.119 2.25 2.5 0 1.381 -1.01 2.5 -2.25 2.5 -1.243 0 -2.25 -1.119 -2.25 -2.5 0 -1.381 1.01 -2.5 2.25 -2.5 z" style="fill:#000;opacity:0.1"/>
<path d="m 20.461 14.65 c 0 0 -3.05 -0.067 -6.256 2.338 0 0 -3.205 5.811 -3.205 12.979 0 0 1.869 3.227 6.789 3.383 0 0 0.825 -1 1.492 -1.846 -2.827 -0.846 -3.895 -2.627 -3.895 -2.627 0.345 0.228 0.565 0.356 0.912 0.557 0.553 0.319 1.113 0.556 1.625 0.756 0.913 0.356 1.998 0.718 3.27 0.959 1.669 0.316 3.626 0.409 5.766 0.02 1.044 -0.19 2.116 -0.489 3.229 -0.957 0.779 -0.289 1.646 -0.713 2.559 -1.314 0 0 -1.111 1.826 -4.03 2.65 0.668 0.846 1.469 1.803 1.469 1.803 c 4.925 -0.159 6.814 -3.383 6.814 -3.383 c 0 -7.168 -3.205 -12.979 -3.205 -12.979 -3.206 -2.404 -6.256 -2.338 -6.256 -2.338 l -0.311 0.357 c 3.784 1.158 5.543 2.826 5.543 2.826 -2.315 -1.269 -4.583 -1.918 -6.701 -2.137 -1.703 -0.176 -3.365 -0.08 -4.875 0.09 -0.777 0.087 -2.671 0.356 -5.05 1.402 -0.824 0.378 -1.313 0.645 -1.313 0.645 0 0 1.847 -1.758 5.854 -2.916 l -0.223 -0.268 m -0.713 8.35 c 1.243 0 2.25 1.119 2.25 2.5 0 1.381 -1.01 2.5 -2.25 2.5 -1.243 0 -2.25 -1.119 -2.25 -2.5 0 -1.381 1.01 -2.5 2.25 -2.5 z m 8.5 0 c 1.243 0 2.25 1.119 2.25 2.5 0 1.381 -1.01 2.5 -2.25 2.5 c -1.243 0 -2.25 -1.119 -2.25 -2.5 0 -1.381 1.01 -2.5 2.25 -2.5" style="fill:#f9f9f9"/>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,18 @@
<svg version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="1" x2="47" gradientTransform="matrix(0 -1 1 0 -1.5e-6 48)" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#146de1" offset="0"/>
<stop style="stop-color:#1e77eb" offset="1"/>
</linearGradient>
</defs>
<path d="m36.31 5c5.859 4.062 9.688 10.831 9.688 18.5 0 12.426-10.07 22.5-22.5 22.5-7.669 0-14.438-3.828-18.5-9.688 1.037 1.822 2.306 3.499 3.781 4.969 4.085 3.712 9.514 5.969 15.469 5.969 12.703 0 23-10.298 23-23 0-5.954-2.256-11.384-5.969-15.469-1.469-1.475-3.147-2.744-4.969-3.781zm4.969 3.781c3.854 4.113 6.219 9.637 6.219 15.719 0 12.703-10.297 23-23 23-6.081 0-11.606-2.364-15.719-6.219 4.16 4.144 9.883 6.719 16.219 6.719 12.703 0 23-10.298 23-23 0-6.335-2.575-12.06-6.719-16.219z" style="opacity:.05"/>
<path d="m41.28 8.781c3.712 4.085 5.969 9.514 5.969 15.469 0 12.703-10.297 23-23 23-5.954 0-11.384-2.256-15.469-5.969 4.113 3.854 9.637 6.219 15.719 6.219 12.703 0 23-10.298 23-23 0-6.081-2.364-11.606-6.219-15.719z" style="opacity:.1"/>
<path d="m31.25 2.375c8.615 3.154 14.75 11.417 14.75 21.13 0 12.426-10.07 22.5-22.5 22.5-9.708 0-17.971-6.135-21.12-14.75a23 23 0 0 0 44.875-7 23 23 0 0 0-16-21.875z" style="opacity:.2"/>
<path d="m24 1c12.703 0 23 10.297 23 23s-10.297 23-23 23-23-10.297-23-23 10.297-23 23-23z" style="fill:url(#bg)"/>
<g transform="translate(1,1)">
<g style="opacity:.1"></g>
</g>
<path d="m40.03 7.531c3.712 4.084 5.969 9.514 5.969 15.469 0 12.703-10.297 23-23 23-5.954 0-11.384-2.256-15.469-5.969 4.178 4.291 10.01 6.969 16.469 6.969 12.703 0 23-10.298 23-23 0-6.462-2.677-12.291-6.969-16.469z" style="opacity:.1"/>
<path d="m26 12c-2.77 0-5 2.23-5 5v4h-4v4h4v13h5v-13h4l0.5-4h-4.5v-3c0-1.108 0.892-2 2-2h2v-4z" style="opacity:.1"/>
<path d="m25 11c-2.77 0-5 2.23-5 5v4h-4v4h4v13h5v-13h4l0.5-4h-4.5v-3c0-1.108 0.892-2 2-2h2v-4z" style="fill:#f9f9f9"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1,18 @@
<svg version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="bg" x1="1" x2="47" gradientTransform="matrix(0 -1 1 0 -1.5e-6 48)" gradientUnits="userSpaceOnUse">
<stop style="stop-color:#ecdada" offset="0"/>
<stop style="stop-color:#f3e7e7" offset="1"/>
</linearGradient>
</defs>
<path d="m36.31 5c5.859 4.062 9.688 10.831 9.688 18.5 0 12.426-10.07 22.5-22.5 22.5-7.669 0-14.438-3.828-18.5-9.688 1.037 1.822 2.306 3.499 3.781 4.969 4.085 3.712 9.514 5.969 15.469 5.969 12.703 0 23-10.298 23-23 0-5.954-2.256-11.384-5.969-15.469-1.469-1.475-3.147-2.744-4.969-3.781zm4.969 3.781c3.854 4.113 6.219 9.637 6.219 15.719 0 12.703-10.297 23-23 23-6.081 0-11.606-2.364-15.719-6.219 4.16 4.144 9.883 6.719 16.219 6.719 12.703 0 23-10.298 23-23 0-6.335-2.575-12.06-6.719-16.219z" style="opacity:.05"/>
<path d="m41.28 8.781c3.712 4.085 5.969 9.514 5.969 15.469 0 12.703-10.297 23-23 23-5.954 0-11.384-2.256-15.469-5.969 4.113 3.854 9.637 6.219 15.719 6.219 12.703 0 23-10.298 23-23 0-6.081-2.364-11.606-6.219-15.719z" style="opacity:.1"/>
<path d="m31.25 2.375c8.615 3.154 14.75 11.417 14.75 21.13 0 12.426-10.07 22.5-22.5 22.5-9.708 0-17.971-6.135-21.12-14.75a23 23 0 0 0 44.875-7 23 23 0 0 0-16-21.875z" style="opacity:.2"/>
<path d="m24 1c12.703 0 23 10.297 23 23s-10.297 23-23 23-23-10.297-23-23 10.297-23 23-23z" style="fill:url(#bg)"/>
<path d="m40.03 7.531c3.712 4.084 5.969 9.514 5.969 15.469 0 12.703-10.297 23-23 23-5.954 0-11.384-2.256-15.469-5.969 4.178 4.291 10.01 6.969 16.469 6.969 12.703 0 23-10.298 23-23 0-6.462-2.677-12.291-6.969-16.469z" style="opacity:.1"/>
<path d="m25.186 10c-3.3431-0.04163-6.6043 1.0349-9.2656 3.0586-5.9715 4.5416-7.6692 12.797-3.9746 19.326 3.6947 6.5294 11.645 9.325 18.613 6.5449 6.7326-2.6857 10.582-9.8016 9.1445-16.906h-14.729v6h8.4785c-1.2705 3.5936-4.667 5.9971-8.4785 6-4.9706 0-9-4.0294-9-9s4.0294-9.0016 9-9c2.386 7.78e-4 4.6734 0.95224 6.3594 2.6406l4.2715-4.2715c-2.7673-2.7675-6.5066-4.3438-10.42-4.3926z" style="opacity:.1"/>
<path d="m24.186 9.0002c-3.3431-0.04163-6.6043 1.0349-9.2656 3.0586-1.8685 1.4211-3.319 3.2058-4.3164 5.1875l1.3711 3.7773 3.5547-0.084c1.2603-3.4494 4.56-5.9173 8.4453-5.916 2.386 7.78e-4 4.6734 0.95224 6.3594 2.6406l4.2715-4.2715c-2.7673-2.7675-6.5066-4.3438-10.42-4.3926z" style="fill:#ef7167"/>
<path d="m10.604 17.246c-2.0764 4.1256-2.1886 9.1044-0.03135 13.434l4.4023 0.34376 0.54492-3.9414c-0.34611-0.95621-0.54492-1.9829-0.54492-3.0586 0-1.0852 0.20266-2.1205 0.55469-3.084z" style="fill:#f6d13c"/>
<path d="m15.52 27.082-4.9473 3.5977c0.11806 0.23693 0.24133 0.47229 0.37305 0.70508 3.6947 6.5294 11.645 9.325 18.613 6.5449 1.5764-0.62883 2.9913-1.503 4.2207-2.5606l-0.80469-3.3457-4.0703-0.48438c-1.433 0.94142-3.133 1.483-4.9297 1.4844-3.8949 0-7.2018-2.479-8.4551-5.9414z" style="fill:#38b85b"/>
<path d="m23.975 21.024v6h8.4785c-0.67174 1.9-1.9414 3.4618-3.5488 4.5176l4.875 3.8281c4.0212-3.4592 6.0244-8.9045 4.9238-14.346z" style="fill:#5c92f0"/>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -31,15 +31,20 @@
<span class="text-primary">Sign Up</span>
</p>
<p class="text-center text-primary">Forgot your password?</p> -->
<div class="position-relative border-bottom my-3 line"><span class="connect">or connect
with</span></div>
<a href="/facebook_auth" class="px-2"> <img
src="https://www.dpreview.com/files/p/articles/4698742202/facebook.jpeg" width="100"
alt="Login with Facebook">
<div class="position-relative border-bottom my-3 line">
<span class="connect">or connect with</span>
</div>
<a href="/google_auth" class="px-2" title="Login with Google"> <img
src="/assets/icons/numix-circle/web-google.svg"
width="100" alt="Login with Google">
</a>
<a href="/facebook_auth" class="px-2" title="Login with Facebook"> <img
src="/assets/icons/numix-circle/web-facebook.svg"
width="100" alt="Login with Facebook">
</a>
<a href="/discord_auth" class="px-2" title="Login with Discord">
<img src="/assets/icons/numix-circle/discord.svg" width="100" alt="Login with Discord" />
</a>
<a href="/discord_auth" title="Image from freepnglogos.com"><img
src="https://www.freepnglogos.com/uploads/discord-logo-png/discord-logo-logodownload-download-logotipos-1.png"
width="100" alt="Login with Discord" /></a>
</div>
</form>