frontend: Improve team registration processus
This commit is contained in:
parent
f05664e2e3
commit
7da127ecb0
5 changed files with 49 additions and 16 deletions
|
@ -30,6 +30,12 @@
|
|||
partJ = true;
|
||||
}
|
||||
|
||||
function JchangeTeam() {
|
||||
value = { };
|
||||
|
||||
partJ = false;
|
||||
}
|
||||
|
||||
function submit(event) {
|
||||
if (!partJ) {
|
||||
JvalidateTeam();
|
||||
|
@ -62,7 +68,11 @@
|
|||
</option>
|
||||
{/each}
|
||||
</select>
|
||||
<Button color="info" type="button" on:click={JvalidateTeam} disabled={partJ}>Valider</Button>
|
||||
{#if partJ}
|
||||
<Button color="info" type="button" on:click={JchangeTeam}>Changer</Button>
|
||||
{:else}
|
||||
<Button color="info" type="button" on:click={JvalidateTeam} disabled={partJ}>Valider</Button>
|
||||
{/if}
|
||||
<div class="invalid-feedback">
|
||||
Veuillez indiquer une équipe valide.
|
||||
</div>
|
||||
|
|
|
@ -37,6 +37,9 @@ function createMyStore() {
|
|||
});
|
||||
} else if (res_my.status === 404) {
|
||||
update((m) => (null));
|
||||
if (cb) {
|
||||
cb(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
import "bootstrap-icons/font/bootstrap-icons.css";
|
||||
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import {
|
||||
Alert,
|
||||
Container,
|
||||
//Styles,
|
||||
} from '@sveltestrap/sveltestrap';
|
||||
|
@ -11,6 +13,7 @@
|
|||
import Header from '$lib/components/Header.svelte';
|
||||
|
||||
import { challengeInfo } from '$lib/stores/challengeinfo';
|
||||
import { my } from '$lib/stores/my.js';
|
||||
import { settings } from '$lib/stores/settings';
|
||||
</script>
|
||||
|
||||
|
@ -32,6 +35,21 @@
|
|||
</div>
|
||||
{/if}
|
||||
<Header />
|
||||
|
||||
{#if !$my && $page.route.id != "/register"}
|
||||
<Container class="mt-3 mb-3">
|
||||
{#if $settings.allowRegistration}
|
||||
<Alert color="warning" class="text-justify" fade={false}>
|
||||
<strong>Votre équipe n'est pas encore enregistrée.</strong> Rendez-vous sur <a href="register">cette page</a> pour procéder à votre inscription.
|
||||
</Alert>
|
||||
{:else}
|
||||
<Alert color="danger" class="text-justify" fade={false}>
|
||||
<strong>Il semblerait qu'il y ait eu un problème lors de l'attribution de votre certificat.</strong> Veuillez vous signaler auprès de notre équipe afin de corriger ce problème.
|
||||
</Alert>
|
||||
{/if}
|
||||
</Container>
|
||||
{/if}
|
||||
|
||||
<slot></slot>
|
||||
|
||||
<style>
|
||||
|
|
|
@ -77,21 +77,12 @@
|
|||
</script>
|
||||
|
||||
<Container class="mt-3 mb-5">
|
||||
{#if !$my}
|
||||
{#if $settings.allowRegistration}
|
||||
<Alert color="warning" class="text-justify" fade={false}>
|
||||
<strong>Votre équipe n'est pas encore enregistrée.</strong> Rendez-vous sur <a href="register">cette page</a> pour procéder à votre inscription.
|
||||
</Alert>
|
||||
{:else}
|
||||
<Alert color="danger" class="text-justify" fade={false}>
|
||||
<strong>Il semblerait qu'il y ait eu un problème lors de l'attribution de votre certificat.</strong> Veuillez vous signaler auprès de notre équipe afin de corriger ce problème.
|
||||
</Alert>
|
||||
{/if}
|
||||
{:else if !($my.team_id)}
|
||||
{#if $my}
|
||||
{#if !($my.team_id)}
|
||||
<Alert color="danger" fade={false}>
|
||||
<strong>Attention :</strong> puisqu'il s'agit de captures effectuées dans le but de découvrir si des actes malveillants ont été commis sur différents systèmes d'information, les contenus qui sont téléchargeables <em>peuvent</em> contenir du contenu malveillant !
|
||||
</Alert>
|
||||
{:else if $teams[$my.team_id]}
|
||||
{:else if $teams[$my.team_id]}
|
||||
<Alert color="info" class="text-justify" fade={false}>
|
||||
<strong>Félicitations {#if $my.members}{#each $my.members as member, index (member.id)}{#if member.id !== $my.members[0].id}{#if member.id === $my.members[$my.members.length - 1].id} et {:else}, {/if}{/if}{member.firstname} {member.lastname}{/each} {/if}!</strong> vous êtes maintenant connecté à l'espace de votre équipe <em>{$teams[$my.team_id].name}</em>.
|
||||
{#if !$settings.denyNameChange}Vous pouvez changer ce nom dès maintenant en vous rendant sur la page de <a href="edit">votre équipe</a>.{/if}
|
||||
|
@ -102,9 +93,9 @@
|
|||
<strong>Les membres de votre équipe ne sont pas encore enregistrés.</strong> Passez voir l'équipe serveur pour corriger cela.
|
||||
</Alert>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
<Masonry
|
||||
{items}
|
||||
let:item
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
Container,
|
||||
Icon,
|
||||
Row,
|
||||
Spinner,
|
||||
} from '@sveltestrap/sveltestrap';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
|
@ -23,8 +24,10 @@
|
|||
let partJ = false;
|
||||
let messageClass;
|
||||
let message;
|
||||
let registrationInProgress = false;
|
||||
|
||||
function gotoHomeOnDiff(i) {
|
||||
registrationInProgress = true;
|
||||
my.refresh((my) => {
|
||||
if (my && my.team_id) {
|
||||
themesStore.refresh(() => {
|
||||
|
@ -32,6 +35,10 @@
|
|||
});
|
||||
} else if (i > 0) {
|
||||
setTimeout(gotoHomeOnDiff, 650, i-1);
|
||||
} else {
|
||||
registrationInProgress = false;
|
||||
messageClass = 'danger';
|
||||
message = "Temps d'attente dépassé.";
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -106,9 +113,13 @@
|
|||
<strong>Oups, il semblerait qu'il y ait eu un problème lors de l'attribution de votre certificat.</strong>
|
||||
Veuillez vous signaler auprès de notre équipe afin de corriger ce problème.
|
||||
</Alert>
|
||||
{:else if registrationInProgress}
|
||||
<div class="d-flex justify-content-center align-items-center gap-4 mt-5 fw-bold text-primary">
|
||||
<Spinner size="lg" color="primary" /> Inscription en cours…
|
||||
</div>
|
||||
{:else}
|
||||
{#if !$settings.denyTeamCreation && !partJ}
|
||||
<Card body class="niceborder my-3">
|
||||
<Card body class="niceborder my-3 text-white">
|
||||
<p>
|
||||
Votre équipe n'est pas encore enregistrée sur notre serveur. Afin de
|
||||
pouvoir participer au challenge, nous vous remercions de bien vouloir
|
||||
|
@ -118,7 +129,7 @@
|
|||
</Card>
|
||||
{/if}
|
||||
{#if $settings.canJoinTeam && !partR}
|
||||
<Card body class="niceborder my-3">
|
||||
<Card body class="niceborder my-3 text-white">
|
||||
<p>
|
||||
{#if !$settings.denyTeamCreation}
|
||||
Si votre équipe est déjà créée, rejoignez-là !
|
||||
|
|
Reference in a new issue