Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions pointercrate-user-pages/src/account/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use pointercrate_core::{
permission::PermissionsManager,
trp,
};
use pointercrate_core_pages::head::Script;
use pointercrate_user::{
auth::{AuthenticatedUser, NonMutating},
config,
Expand All @@ -24,14 +23,6 @@ impl AccountPageTab for ProfileTab {
"/static/user/js/account/profile.js".into()
}

fn additional_scripts(&self) -> Vec<Script> {
if cfg!(feature = "oauth2") {
vec![Script::r#async("https://accounts.google.com/gsi/client")]
} else {
Vec::new()
}
}

fn tab_id(&self) -> u8 {
1
}
Expand Down Expand Up @@ -147,7 +138,7 @@ impl AccountPageTab for ProfileTab {
data-client_id=(config::google_client_id())
data-callback="googleOauthCallback" {}

script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) async {}
script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) defer {}
div .g_id_signin data-text="continue_with" style="margin: 10px 0px" data-locale=(lang) {}
p.error #g-signin-error style="text-align: left" {}
}
Expand Down
12 changes: 3 additions & 9 deletions pointercrate-user-pages/src/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@ use pointercrate_core_pages::{head::HeadLike, trp_html, PageFragment};
use pointercrate_user::config;

pub fn login_page() -> PageFragment {
let mut frag = PageFragment::new(
PageFragment::new(
"Pointercrate - Login",
"Log in to an existing pointercrate account or register for a new one!",
)
.module("/static/user/js/login.js")
.module("/static/core/js/modules/form.js")
.module("/static/core/js/modules/tab.js")
.stylesheet("/static/user/css/login.css")
.body(login_page_body());

if cfg!(feature = "oauth2") {
frag = frag.async_script("https://accounts.google.com/gsi/client");
}

frag
.body(login_page_body())
}

fn login_page_body() -> Markup {
Expand All @@ -43,7 +37,7 @@ fn login_page_body() -> Markup {
data-client_id=(config::google_client_id())
data-callback="googleOauthCallback" {}

script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) async {}
script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) defer {}
div .g_id_signin data-text="continue_with" style="margin: 10px 0px" data-locale=(lang) {}
p.error #g-signin-error style="text-align: left" {}

Expand Down
12 changes: 3 additions & 9 deletions pointercrate-user-pages/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ use pointercrate_core_pages::{trp_html, PageFragment};
use pointercrate_user::config;

pub fn registration_page() -> PageFragment {
let mut frag = PageFragment::new("Pointercrate - Registration", "Register for a new pointercrate account!")
PageFragment::new("Pointercrate - Registration", "Register for a new pointercrate account!")
.module("/static/user/js/register.js")
.module("/static/core/js/modules/form.js")
.module("/static/core/js/modules/tab.js")
.stylesheet("/static/user/css/login.css")
.body(register_page_body());

if cfg!(feature = "oauth2") {
frag = frag.async_script("https://accounts.google.com/gsi/client");
}

frag
.body(register_page_body())
}

fn register_page_body() -> Markup {
Expand All @@ -41,7 +35,7 @@ fn register_page_body() -> Markup {
data-client_id=(config::google_client_id())
data-callback="googleOauthRegisterCallback" {}

script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) async {}
script src=(format!("https://accounts.google.com/gsi/client?hl={}", &lang)) defer {}
div .g_id_signin data-text="signup_with" style="margin: 10px 0px" {}
@if cfg!(feature = "legacy_accounts") {
p.or style="text-size: small; margin: 0px" { (tr("login.methods-separator")) }
Expand Down
Loading