From 08c662a65f082c0f719c2d4ec5838789616acb3c Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Sun, 10 Mar 2024 20:32:23 +0100 Subject: [PATCH 1/2] Fetch inscription on backend This commit is waiting for the backend implementation to be merged. The list of field expected is writen in comment --- frontend/src/Apps/Inscription.vue | 30 ++++--------------------- frontend/src/rest/ServiceInscription.js | 26 ++++++++++++--------- 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/frontend/src/Apps/Inscription.vue b/frontend/src/Apps/Inscription.vue index 0ba7fce..511a403 100644 --- a/frontend/src/Apps/Inscription.vue +++ b/frontend/src/Apps/Inscription.vue @@ -1,32 +1,10 @@ diff --git a/frontend/src/rest/ServiceInscription.js b/frontend/src/rest/ServiceInscription.js index ee75c3b..7048093 100644 --- a/frontend/src/rest/ServiceInscription.js +++ b/frontend/src/rest/ServiceInscription.js @@ -3,28 +3,34 @@ * * TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future. */ -import { restGet } from './restConsumer.js' +import { restGet, restPost } from './restConsumer.js' /** * create a new register requests that can be recovered by the registering service * TODO: add info in the Object (I don't know what will be needed) */ export async function createRegister(){ - return restPost("/requests/register"}); + return restPost("/requests/register"); } /** * list all register request in a list of Objects - */ -export async function getRegisters(){ - return restGet("/requests/register") -} - -/** - * Get info on a particular registering request + * Shall return a list of + * - id + * - type + * - lastName + * - firstName + * - address + * - country + * - birthdate + * - email + * - cursus + * - degree */ export async function getRegisters(id){ - return restGet("/requests/register/" + id); + if(id != null) + return restGet("/requests/register/" + id); + return restGet("/requests/register") } /** From 198ee8a4ce03e46ea878acc16ea972184b22ef0a Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Fri, 15 Mar 2024 14:46:39 +0100 Subject: [PATCH 2/2] Register API and form optimization [depend: backend /register] (#93) Made the register api following the backend refactored the register form for more ergonomy **PS: Waiting for the backend to catch up** Reviewed-on: https://git.herisson.ovh/PGL/Clyde/pulls/93 Reviewed-by: Maxime <231026@umons.ac.be> Reviewed-by: Wal Reviewed-by: LeoMoulin Co-authored-by: Anthony Debucquoy Co-committed-by: Anthony Debucquoy --- frontend/src/Apps/Login.vue | 24 +++++++---------- frontend/src/rest/Users.js | 53 +++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 17 deletions(-) diff --git a/frontend/src/Apps/Login.vue b/frontend/src/Apps/Login.vue index b7b3242..a5043e8 100644 --- a/frontend/src/Apps/Login.vue +++ b/frontend/src/Apps/Login.vue @@ -7,23 +7,16 @@ const loginPage= ref(true) const page = ref(0) - const emailID=ref("") - const passwordIN=ref("") - - const submitValue= ref(i18n("login.guest.submit")) const surname=ref("") const firstname=ref("") - const passwordOUT=ref("") + const password=ref("") const passwordConfirm=ref("") const birthday=ref("") - const emailOUT=ref("") + const email=ref("") const address=ref("") const country=ref("") const cursus=ref("") - const loginInfos = [{_emailID:emailID},{_passwordIN:passwordIN}] - const registerInfos= [{_surname:surname},{_firstname:firstname},{_birthday:birthday},{_passwordOUT:passwordOUT}, - {_passwordConfirm:passwordConfirm},{_emailOUT:emailOUT},{_address:address},{_country:country},{_cursus:cursus}] const imageSaved = ref(false) const ppData = ref(false) @@ -34,17 +27,17 @@
-
+

{{i18n("login.guest.signin")}}

ID / {{i18n("login.guest.email")}}

- +

{{i18n("login.guest.password")}}

- +
- +

{{i18n("login.guest.welcome")}}

@@ -75,11 +68,12 @@

{{i18n("login.guest.password")}}

- +

{{i18n("login.guest.confirm")}} {{i18n("login.guest.password")}}

+
@@ -93,7 +87,7 @@

{{i18n("login.guest.email")}}

- +

{{i18n("login.guest.address")}}

diff --git a/frontend/src/rest/Users.js b/frontend/src/rest/Users.js index f15dac5..b786f0d 100644 --- a/frontend/src/rest/Users.js +++ b/frontend/src/rest/Users.js @@ -4,8 +4,57 @@ export async function login(user, pass, exp){ return restPost("/login", {identifier: user, password: pass, expirationDate: exp}); } -export async function register(user, pass, mail){ - return restPost("/user", {name: user, password: pass, mail: mail}); +/** + * Register a user (tokenless) + * + * @param firstname + * @param lastname + * @param birthdate + * @param password + * @param mail + * @param address + * @param country + * @param cursus + * @param imageId id of the image in database returned when uploaded + */ +export async function register(firstname, lastname, birthDate, password, email, address, country, cursus, imageId){ + return restPost("/register", { + firstname: firstname, + lastname: lastname, + birthDate: birthDate, + password: password, + email: email, + address: address, + country: country, + cursus: cursus + }); +} + +/** + * Register a user (by secretary) + * + * @param firstname + * @param lastname + * @param birthdate + * @param password + * @param mail + * @param address + * @param country + * @param imageId id of the image in database returned when uploaded + * + * PS: the password is not is not required as it is generated by the backend and sent to the user + * by mail. it's up to the user to change it if he cares about security + */ +export async function createUser(firstname, lastname, birthDate, email, address, country, role, imageId){ + return restPost("/user", { + firstname: firstname, + lastname: lastname, + birthDate: birthDate, + password: password, + email: email, + address: address, + country: country, + }); } /**