FINAL COMMIT
This commit is contained in:
parent
77ac771b8f
commit
4715441afd
@ -53,9 +53,9 @@ public class MockController {
|
|||||||
User joe = new User("Mama","Joe","student@student.com","roundabout","DaWarudo",new Date(0), null,Role.Student,passwordEncoder.encode("student"));
|
User joe = new User("Mama","Joe","student@student.com","roundabout","DaWarudo",new Date(0), null,Role.Student,passwordEncoder.encode("student"));
|
||||||
User meh = new User("Inspiration","lackOf","secretary@secretary.com","a Box","the street",new Date(0), null,Role.Secretary,passwordEncoder.encode("secretary"));
|
User meh = new User("Inspiration","lackOf","secretary@secretary.com","a Box","the street",new Date(0), null,Role.Secretary,passwordEncoder.encode("secretary"));
|
||||||
User joke = new User("CthemBalls","Lemme","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
|
User joke = new User("CthemBalls","Lemme","teacher@teacher.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
|
||||||
User joke = new User("hhoo","yeay","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
|
User jojo = new User("hhoo","yeay","teacher2@teacher2.com","lab","faculty",new Date(0), null,Role.Teacher,passwordEncoder.encode("teacher"));
|
||||||
User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,passwordEncoder.encode("inscriptionService"));
|
User lena = new User("Louille","Lena","inscriptionService@InscriptionService.com","no","yes",new Date(0), null,Role.InscriptionService,passwordEncoder.encode("inscriptionService"));
|
||||||
mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena));
|
mockUsers = new ArrayList<>(Arrays.asList(herobrine,joe,meh,joke,lena,jojo));
|
||||||
|
|
||||||
userRepo.saveAll(mockUsers);
|
userRepo.saveAll(mockUsers);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class UserController {
|
|||||||
|
|
||||||
@DeleteMapping("/user/{id}")
|
@DeleteMapping("/user/{id}")
|
||||||
public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
||||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) || id.equals(authServ.getUserFromToken(token).getRegNo()))
|
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token) && !id.equals(authServ.getUserFromToken(token).getRegNo()))
|
||||||
return new UnauthorizedResponse<>(null);
|
return new UnauthorizedResponse<>(null);
|
||||||
|
|
||||||
User toDelete = userService.getUserById(id);
|
User toDelete = userService.getUserById(id);
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
}, "500");
|
}, "500");
|
||||||
}
|
}
|
||||||
function verifyInputs(pass){
|
function verifyInputs(pass){
|
||||||
console.log(pass)
|
|
||||||
if(pass==passwordConfirm.value){
|
if(pass==passwordConfirm.value){
|
||||||
page.value++;
|
page.value++;
|
||||||
return toast('Password and Confirm Password are correct.', {
|
return toast('Password and Confirm Password are correct.', {
|
||||||
@ -141,7 +140,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div style="align-self:center;" class="inputBox">
|
<div style="align-self:center;" class="inputBox">
|
||||||
<button style="margin-top:25px;" @click="console.log(outputs);register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData);">
|
<button style="margin-top:25px;" @click="register(outputs.firstname, outputs.surname, outputs.birthday, outputs.password, outputs.email, outputs.address, outputs.country, outputs.curriculum, ppData);">
|
||||||
{{i18n("login.guest.submit")}}
|
{{i18n("login.guest.submit")}}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
const curriculum = ref(await getCourses(self.role));
|
const curriculum = ref(await getCourses(self.role));
|
||||||
const profList = await getTeachers();
|
const profList = await getTeachers();
|
||||||
|
|
||||||
console.log(curriculum)
|
|
||||||
console.log(profList)
|
|
||||||
|
|
||||||
const createMod = ref(false)
|
const createMod = ref(false)
|
||||||
const deleteMod = ref(false)
|
const deleteMod = ref(false)
|
||||||
|
@ -6,19 +6,15 @@
|
|||||||
import i18n from "@/i18n.js"
|
import i18n from "@/i18n.js"
|
||||||
import { uploadProfilePicture } from '@/rest/uploads.js'
|
import { uploadProfilePicture } from '@/rest/uploads.js'
|
||||||
|
|
||||||
const user = await getSelf();
|
const user = ref(await getSelf());
|
||||||
console.log(user);
|
|
||||||
const UserCurriculum = ref("");
|
const UserCurriculum = ref("");
|
||||||
const curricula = ref (await getAllCurriculums());
|
const curricula = ref (await getAllCurriculums());
|
||||||
console.log(curricula)
|
if(user.value.role === "Student"){
|
||||||
console.log(user.role === "Teacher")
|
|
||||||
if(user.role === "Student"){
|
|
||||||
UserCurriculum.value = await getSelfCurriculum();
|
UserCurriculum.value = await getSelfCurriculum();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.role === "Teacher"){
|
if(user.role === "Teacher"){
|
||||||
UserCurriculum.value = await getCourses("Teacher");
|
UserCurriculum.value = await getCourses("Teacher");
|
||||||
console.log(UserCurriculum.value)
|
|
||||||
}
|
}
|
||||||
const modif = ref(false);
|
const modif = ref(false);
|
||||||
const curric = ref(false);
|
const curric = ref(false);
|
||||||
@ -27,7 +23,7 @@
|
|||||||
const pattern = {
|
const pattern = {
|
||||||
profilPictureUrl:null,
|
profilPictureUrl:null,
|
||||||
email:null,
|
email:null,
|
||||||
adress:null,
|
address:null,
|
||||||
password:null,
|
password:null,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,17 +42,38 @@
|
|||||||
inputs=Object.assign({},list);
|
inputs=Object.assign({},list);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChangeInfos(){
|
async function ChangeInfos(){
|
||||||
for (const [key, value] in Object.entries(toModify)){
|
for (let element in toModify){
|
||||||
if(value !== null){
|
if (element =="email" && (toModify[element] !== null)){
|
||||||
alterSelf({key:value});
|
await alterSelf(user.value.regNo,{email : toModify[element]});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (element =="profilPictureUrl" && (toModify[element] !== null)){
|
||||||
|
await alterSelf(user.value.regNo,{ profilPictureUrl : toModify[element]});
|
||||||
|
}
|
||||||
|
else if(element == "address" && (toModify[element] !== null)){
|
||||||
|
await alterSelf(user.value.regNo,{address : toModify[element]});
|
||||||
|
}
|
||||||
|
else if(element == "password" && (toModify[element] !== null)){
|
||||||
|
await alterSelf(user.value.regNo,{password : toModify[element]});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
toModify= Object.assign({}, pattern);
|
toModify= Object.assign({},pattern);
|
||||||
|
user.value = await getSelf()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function setModify(item){
|
||||||
|
toModify.address = item.address;
|
||||||
|
toModify.profilPictureUrl = item.profilPictureUrl;
|
||||||
|
toModify.email= item.email;
|
||||||
|
toModify.password= item.password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function unRegister(){
|
async function unRegister(){
|
||||||
disconnect();
|
deleteUser(user.value.regNo);
|
||||||
|
disconnect()
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.href="#/home";
|
window.location.href="#/home";
|
||||||
}, "500");
|
}, "500");
|
||||||
@ -64,7 +81,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPP(){
|
function getPP(){
|
||||||
if(user.profilePictureUrl === null){
|
if(user.value.profilePictureUrl === null){
|
||||||
return "/Clyde.png"
|
return "/Clyde.png"
|
||||||
}
|
}
|
||||||
return user.profilePictureUrl
|
return user.profilePictureUrl
|
||||||
@ -93,7 +110,7 @@
|
|||||||
Role: {{i18n((user.role))}}
|
Role: {{i18n((user.role))}}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click="modif=!modif"> {{i18n("profile.modify.data")}} </button>
|
<button @click="modif=!modif; setModify(user)"> {{i18n("profile.modify.data")}} </button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="(user.role==='Student')">
|
<div v-if="(user.role==='Student')">
|
||||||
<button @click="reg=!reg">{{i18n("profile.reRegister")}}</button>
|
<button @click="reg=!reg">{{i18n("profile.reRegister")}}</button>
|
||||||
@ -110,23 +127,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
E-mail:
|
E-mail:
|
||||||
<input type="mail" v-model="personnalInfos.email" />
|
<input type="mail" v-model="toModify.email" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{i18n("profile.address")}}:
|
{{i18n("profile.address")}}:
|
||||||
<input type="text" v-model="personnalInfos.id">
|
<input type="text" v-model="toModify.id">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{i18n("login.password")}}:
|
{{i18n("login.password")}}:
|
||||||
<input type="password" v-model="personnalInfos.password">
|
<input type="password" v-model="toModify.password">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
{{i18n("login.cPassword")}}:
|
{{i18n("login.cPassword")}}:
|
||||||
<input type="password" v-model="personnalInfos.passwordConfirm">
|
<input type="password" v-model="toModify.passwordConfirm">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button>
|
<button @click=" modif=!modif; ChangeInfos();">{{i18n("courses.confirm")}}</button>
|
||||||
<button @click="modif=!modif; resetInputs(toModify,pattern);console.log(pattern)" style="float:right;">{{i18n("courses.back")}}</button>
|
<button @click="modif=!modif; resetInputs(toModify,pattern);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="curric" class="infosContainer">
|
<div v-else-if="curric" class="infosContainer">
|
||||||
@ -162,7 +179,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button @click=" reg=!reg;">{{i18n("courses.confirm")}}</button>
|
<button @click=" reg=!reg;">{{i18n("courses.confirm")}}</button>
|
||||||
<button @click=" reg=!reg; resetInputs(personnalInfos,patternInfos);console.log(pattern)" style="float:right;">{{i18n("courses.back")}}</button>
|
<button @click=" reg=!reg; resetInputs(personnalInfos,patternInfos);" style="float:right;">{{i18n("courses.back")}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
import { getStudents } from '../rest/Users.js'
|
import { getStudents } from '../rest/Users.js'
|
||||||
|
|
||||||
const users = await getStudents();
|
const users = await getStudents();
|
||||||
console.log(users)
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-for="item in users">
|
<div v-for="item in users">
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
const users = await getAllUsers();
|
const users = await getAllUsers();
|
||||||
|
|
||||||
console.log(users);
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div v-for="item in users">
|
<div v-for="item in users">
|
||||||
|
@ -140,8 +140,9 @@ export async function getSelf(){
|
|||||||
* - Adress
|
* - Adress
|
||||||
* - Password
|
* - Password
|
||||||
*/
|
*/
|
||||||
export async function alterSelf(data){
|
export async function alterSelf(id,data){
|
||||||
return restPatch("/user", data);
|
console.log(data)
|
||||||
|
return restPatch("/user/"+id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user