Skip to content

Commit

Permalink
WIP fp mrcc
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Feb 13, 2024
1 parent b44b1df commit 57ec7bf
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 50 deletions.
13 changes: 1 addition & 12 deletions account-gui/src/routes/MagicLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,6 @@

<style lang="scss">
.back-container {
position: absolute;
left: 15px;
top: 15px;
cursor: pointer;
}
div.magic-link {
margin-top: 40px;
display: flex;
Expand Down Expand Up @@ -235,13 +228,9 @@
</div>

{:else if loginStatus === status.NOT_LOGGED_IN}
<div class="back-container">
<a href={`/login/${id}?name=${serviceName}&modus=${modus}`}>{@html backArrow}</a>
</div>

<div class="magic-link">
<h2 class="header">{I18n.t("magicLink.header")}</h2>
<p>{I18n.t("magicLink.info")}<span class="email">{$user.email}.</span></p>
<p>{I18n.t("magicLink.info")}<span class="email">{$user.email}.</span></p>
<div class="spinner-container">
<Spinner relative={true}/>
<p>{I18n.t("magicLink.awaiting")}</p>
Expand Down
3 changes: 2 additions & 1 deletion account-gui/src/routes/Options.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import LoginOption from "../components/LoginOption.svelte";
import {links} from "../stores/conf";
import {navigate} from "svelte-routing";
import {mrcc} from "../utils/constants";
export let id;
Expand Down Expand Up @@ -79,6 +80,6 @@
translationKey={option.key}
preferred={option.preferred}
index={i + 1}
route={`/${option.key.toLowerCase()}/${id}`}/>
route={`/${option.key.toLowerCase()}/${id}?${mrcc}=true`}/>
{/each}
{/if}
45 changes: 24 additions & 21 deletions account-gui/src/routes/UseLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,28 @@
import {loginPreferences} from "../constants/loginPreferences";
import {cookieNames} from "../constants/cookieNames";
import {links} from "../stores/conf";
import {mrcc} from "../utils/constants";
export let id;
let showSpinner = true;
let serviceName = "";
let magicLink = false;
let mrccValue = null;
onMount(() => {
const urlParams = new URLSearchParams(window.location.search);
magicLink = urlParams.has("magicLink")
mrccValue = urlParams.get(mrcc);
magicLink = urlParams.has("magicLink");
$links.displayBackArrow = true;
fetchServiceName(id).then(res => {
serviceName = res.name;
showSpinner = false;
});
if (mrccValue) {
magicLinkStart();
} else {
$links.displayBackArrow = true;
fetchServiceName(id).then(res => {
serviceName = res.name;
showSpinner = false;
});
}
});
const magicLinkStart = () => {
Expand All @@ -49,20 +55,17 @@
};
</script>

<style lang="scss">
</style>
{#if showSpinner}
<Spinner/>
{/if}
<h2 class="header">{I18n.t("useLink.header")}</h2>
{#if serviceName}
<h2 class="top">{I18n.t("login.headerSubTitle")}<span>{serviceName}</span></h2>
{/if}
<Button href="/start"
disabled={showSpinner}
label={I18n.t("useLink.next")}
className="full"
onClick={magicLinkStart}/>
{#if !showSpinner && !mrccValue}
<h2 class="header">{I18n.t("useLink.header")}</h2>
{#if serviceName}
<h2 class="top">{I18n.t("login.headerSubTitle")}<span>{serviceName}</span></h2>
{/if}
<Button href="/start"
disabled={showSpinner}
label={I18n.t("useLink.next")}
className="full"
onClick={magicLinkStart}/>
{/if}
40 changes: 25 additions & 15 deletions account-gui/src/routes/UseWebAuth.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,27 @@
import {cookieNames} from "../constants/cookieNames";
import {loginPreferences} from "../constants/loginPreferences";
import {links} from "../stores/conf";
import {mrcc} from "../utils/constants";
export let id;
let showSpinner = true;
let serviceName = "";
let mrccValue = null;
onMount(() => {
$links.displayBackArrow = true;
fetchServiceName(id).then(res => {
serviceName = res.name;
const urlParams = new URLSearchParams(window.location.search);
mrccValue = urlParams.get(mrcc);
if (mrccValue) {
showSpinner = false;
});
webAuthnStart();
} else {
$links.displayBackArrow = true;
fetchServiceName(id).then(res => {
serviceName = res.name;
showSpinner = false;
});
}
});
const webAuthnStart = (test = false) => {
Expand Down Expand Up @@ -61,15 +70,16 @@
{#if showSpinner}
<Spinner/>
{/if}
<h2 class="header">{I18n.t("webAuthn.header")}</h2>
{#if serviceName}
<h2 class="top">{I18n.t("login.headerSubTitle")}<span>{serviceName}</span></h2>
{/if}
<p class="explanation">{I18n.t("webAuthn.explanation")}</p>
<Button href="/start"
disabled={showSpinner}
label={I18n.t("webAuthn.next")}
className="full"
onClick={webAuthnStart}/>

<h2 class="header">{I18n.t("webAuthn.header")}</h2>
{#if serviceName}
<h2 class="top">{I18n.t("login.headerSubTitle")}<span>{serviceName}</span></h2>
{/if}
<p class="explanation">{I18n.t("webAuthn.explanation")}</p>
<Button href="/start"
disabled={showSpinner}
label={I18n.t("webAuthn.next")}
className="full"
onClick={webAuthnStart}/>


1 change: 1 addition & 0 deletions account-gui/src/utils/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const mrcc = "mrcc";
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected void doSendMail(MimeMessage message) {
@Override
protected void setText(String html, String text, MimeMessageHelper helper) {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("mac os x") && !env.acceptsProfiles(Profiles.of("test"))) {
if (osName.contains("mac os x!") && !env.acceptsProfiles(Profiles.of("test"))) {
openInBrowser(html);
}
}
Expand Down

0 comments on commit 57ec7bf

Please sign in to comment.