1
0
forked from PGL/Clyde

Merge pull request 'Better login' (#170) from betterlogin into master

Reviewed-on: PGL/Clyde#170
This commit is contained in:
LeoMoulin 2024-04-21 22:35:20 +02:00
commit 2d20b45c3a
5 changed files with 30 additions and 30 deletions

View File

@ -24,7 +24,6 @@ public class AuthenticatorService {
return tokenService.getUserFromToken(token);
}
public String login(String identifier, String password, Date expirationDate){
User user = userService.getUser(identifier);
if (user == null){return null;}

View File

@ -28,6 +28,7 @@ public class InscriptionService {
private final MinervalRepository minervalRepository;
private final ExternalCurriculumRepository externalCurriculumRepository;
private final UserService userService;
public InscriptionService(InscriptionRepository inscriptionRepo, UserRepository userRepo, UserCurriculumRepository userCurriculumRepo, CurriculumRepository curriculumRepo, MinervalRepository minervalRepository, ExternalCurriculumRepository externalCurriculumRepository, UserService userService){
this.inscriptionRepo = inscriptionRepo;
this.userRepo = userRepo;

View File

@ -117,6 +117,7 @@ public class ProtectionService {
toReturn.put("identityCard", inscriptionRequest.getIdentityCard());
toReturn.put("submissionDate", inscriptionRequest.getSubmissionDate());
toReturn.put("equivalenceState", inscriptionRequest.getEquivalenceState());
toReturn.put("admissionDocUrl", inscriptionRequest.getAdmissionDocUrl());
return toReturn;
}

View File

@ -58,17 +58,17 @@ async function refreshCursus(){
{{ i18n("login.guest.country") }} : {{request.country}}
</div>
<div>
{{ i18n("login.guest.birthday") }} : {{request.birthDate}}
{{ i18n("login.guest.birthday") }} : {{request.birthDate.slice(0,10)}}
</div>
<div>
{{ i18n("WantedCursus") }} : BAB {{cursus.year}} {{cursus.option}}
</div>
<div style="margin-top: 3%">
<button><a :href="request.identityCard">{{ i18n("dlidentitycard") }}</a></button>
<button v-if="request.admissionDocUrl != null"><a :href="request.admissionDocUrl">{{ i18n("dladmissiondoc") }}</a></button>
<button style="margin-left: 3%" v-if="request.admissionDocUrl != null"><a :href="request.admissionDocUrl">{{ i18n("dladmissiondoc") }}</a></button>
</div>
<div v-if="externalCurriculum.length !== 0">
<button style="background-color:rgb(105,05,105);margin-top: 3%" @click="list=!list" v-if="(user.role == 'Teacher' || user.role == 'Admin')">{{ i18n("seeextcur") }}</button>
<div>
<button style="background-color:rgb(105,05,105);margin-top: 3%" @click="list=!list" v-if="(user.role === 'Teacher' || user.role === 'Admin')">{{ i18n("seeextcur") }}</button>
</div>
</div>
</div>

View File

@ -16,7 +16,7 @@
surname:null,
firstname:null,
password:null,
birthday:null,
birthday:"1990-01-01",
email:null,
address:null,
country:null,
@ -36,7 +36,7 @@
const ppData = ref({})
const idcardfile = ref({})
const justifcardfile = ref({})
const allfileshere = ref(0)
const curricula= await getAllCurriculums();
function goBackHome(){
@ -73,7 +73,13 @@
//We upload the two files and we get their paths on the server
const identityCardFile = await uploadFile(idcardfile.value, "IdentityCard")
const justifFile = ref(null)
const profilepic = await uploadProfilePicture(ppData.value)
const profilepic = ref(null)
if (imageSaved){
profilepic.value = await uploadProfilePicture(ppData.value)
}
if (curricula[outputs.curriculum-1].requireCertificate){
justifFile.value = await uploadFile(justifcardfile.value, "JustificationDocument")
@ -86,7 +92,7 @@
justif = null
}
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, profilepic.url, identityCardFile.url, new Date(), outputs.equivalenceState, justif);
const val = await register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, profilepic.value.url, identityCardFile.url, new Date(), outputs.equivalenceState, justif);
for (let item in externalCurrTab.value){
const temp = await uploadFile(externalCurrTab.value[item].justifdocUrl, "JustificationDocument")
@ -94,6 +100,13 @@
}
}
function everyfilehere(){
if(allfileshere.value === 2 || (allfileshere.value === 1 && curricula[outputs.curriculum-1].requireCertificate === false)){
return true
}else{
return false
}
}
</script>
<template>
@ -138,7 +151,7 @@
</div>
<div class="inputBox">
<p>{{i18n("login.guest.birthday")}}</p>
<input type="date" v-model="outputs.birthday">
<input type="date" v-model="outputs.birthday" value="1990-01-05" min="1912-01-01" max="2024-01-01">
</div>
<div class="inputBox">
<p>{{i18n("login.guest.password")}}</p>
@ -150,7 +163,7 @@
</div>
<div class="switchpage">
<button @click="verifyInputs(outputs.password);">{{i18n("login.guest.nextpage")}}</button>
<button @click="verifyInputs(outputs.password);idcardfile={};justifcardfile={}">{{i18n("login.guest.nextpage")}}</button>
</div>
<div @click="(loginPage=!loginPage) && (page=0)" class="register">
@ -173,13 +186,7 @@
<form class="inputBox" novalidate enctype="multipart/form-data">
<p>{{i18n("profile.picture").toUpperCase()}}</p>
</form>
<label class="browser">
{{i18n("login.guest.browse")}}
<input type="file" :disabled="imageSaved" @change="ppData = $event.target.files; imageSaved = true;" accept="image/*">
</label>
<form novalidate enctype="multipart/form-data" class="inputBox">
<input type="file" @change="imageSaved = true;" accept="image/*">
</form>
<input style="color:rgb(239,60,168);" type="file" name="picture" @change="ppData = $event.target.files;imageSaved=true" accept="image/*">
<div class="inputBox">
<p>{{i18n("Curriculum").toUpperCase()}}</p>
<select v-model="outputs.curriculum">
@ -203,21 +210,16 @@
</div>
<div v-if="page === 2">
<p style="color:rgb(239,60,168);">{{i18n("login.guest.identityCard")}}</p>
<label class="browser">
{{i18n("login.guest.browse")}}
<input type="file" @change="idcardfile = $event.target.files">
</label>
<input style="color:rgb(239,60,168);margin-bottom: 3%" type="file" @change="idcardfile = $event.target.files;allfileshere = Math.min(allfileshere+1, 2)">
<div v-if="curricula[outputs.curriculum-1].requireCertificate === true" style="margin-top: 3%; margin-bottom: 4%">
<p style="color:rgb(239,60,168);">{{ i18n("login.guest.attestationdisclaimer") }}</p>
<div style="margin-top: 2%">
<p style="color:rgb(239,60,168);">Attestation:</p>
<label class="browser">
{{i18n("login.guest.browse")}}
<input type="file" @change="justifcardfile = $event.target.files">
</label>
<input style=" color:rgb(239,60,168);" type="file" @change="justifcardfile = $event.target.files;allfileshere = Math.min(allfileshere+1, 2)">
</div>
</div>
<button @click="page++;" style="margin-top: 10%">{{i18n("login.guest.nextpage")}}</button>
<div v-if="everyfilehere()"><button @click="page++;" style="margin-top: 10%">{{i18n("login.guest.nextpage")}}</button></div>
<div v-else style="color: rgb(239,60,168); margin-top: 5%; margin-bottom: 5%">Please upload all the required files</div>
</div>
<div v-if="page === 3">
<p style="color:rgb(239,60,168);margin-bottom: 5%">
@ -320,9 +322,6 @@ input[type=submit],button,select{
}
input[type=file]{
display:none;
}
.browser{
display:inline-block;