Compare commits
8 Commits
8ff29ca34e
...
92079c5a47
Author | SHA1 | Date | |
---|---|---|---|
92079c5a47 | |||
753af3874e | |||
e03a01ec89 | |||
fd18df7c3a | |||
93c161be4c | |||
a80fb2b297 | |||
f484fb095e | |||
2fb6aef67c |
BIN
backend/cdn/0b6b478c-9b05-4190-a7f3-c6414135c236.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/10217f04-10cf-412f-87d7-aa427bfe0de5.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/2a18cb2c-a675-4f54-a25b-e6099547d24d.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/3af9e590-794a-401f-8dce-97437ee4a2eb.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/8f4e3a22-1261-4afd-b226-c00bd74f02ed.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/912f2a1e-d331-4fc6-9cc5-c5ef2f1d8e9d.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
BIN
backend/cdn/fa7deac8-a4db-4f1a-8b2e-0f1388c81045.jpg
Normal file
After Width: | Height: | Size: 29 KiB |
@ -11,7 +11,6 @@ import ovh.herisson.Clyde.Services.TeacherCourseService;
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -120,4 +119,20 @@ public class CourseController {
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("course/{id}")
|
||||
public ResponseEntity<String> deleteUser(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Course toDelete = courseServ.findById(id);
|
||||
|
||||
if (toDelete == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
|
||||
courseServ.delete(courseServ.findById(id));
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -67,4 +67,18 @@ public class CurriculumController {
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@DeleteMapping("/curriculum/{id}")
|
||||
public ResponseEntity<String > deleteCurriculum(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary}, token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Curriculum toDelete = curriculumServ.findById(id);
|
||||
|
||||
if (toDelete == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
curriculumServ.delete(toDelete);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.InscriptionService;
|
||||
import ovh.herisson.Clyde.Services.ProtectionService;
|
||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.RequestState;
|
||||
import ovh.herisson.Clyde.Tables.Role;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@ -34,13 +33,8 @@ public class InscriptionController {
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
Iterable<InscriptionRequest> inscriptionRequests = inscriptionServ.getAll();
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
||||
for (InscriptionRequest i:inscriptionRequests){
|
||||
toReturn.add(requestWithoutPassword(i));
|
||||
}
|
||||
|
||||
return new ResponseEntity<>(toReturn, HttpStatus.OK);
|
||||
return new ResponseEntity<>(ProtectionService.requestsWithoutPasswords(inscriptionRequests), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@ -55,38 +49,35 @@ public class InscriptionController {
|
||||
if (foundInscriptionRequest == null)
|
||||
return new ResponseEntity<>(null, HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(requestWithoutPassword(foundInscriptionRequest), HttpStatus.OK);
|
||||
return new ResponseEntity<>(ProtectionService.requestWithoutPassword(foundInscriptionRequest), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PatchMapping("/request/register/{id}")
|
||||
public ResponseEntity<InscriptionRequest> changeRequestState(@PathVariable long id,
|
||||
@RequestHeader("Authorization") String token,
|
||||
@RequestBody RequestState requestState)
|
||||
@RequestBody RequestState state)
|
||||
{
|
||||
|
||||
System.out.println(requestState);
|
||||
if (authServ.isNotIn(new Role[]{Role.InscriptionService,Role.Admin},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
if (!inscriptionServ.modifyState(id, requestState))
|
||||
if (!inscriptionServ.modifyState(id, state))
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@DeleteMapping("/request/register/{id}")
|
||||
public ResponseEntity<String > deleteRequest(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.InscriptionService}, token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
private Map<String, Object> requestWithoutPassword(InscriptionRequest inscriptionRequest) {
|
||||
Map<String, Object> toReturn = new HashMap<>();
|
||||
InscriptionRequest toDelete = inscriptionServ.getById(id);
|
||||
|
||||
toReturn.put("id", inscriptionRequest.getId());
|
||||
toReturn.put("lastName", inscriptionRequest.getLastName());
|
||||
toReturn.put("firstName", inscriptionRequest.getFirstName());
|
||||
toReturn.put("address", inscriptionRequest.getAddress());
|
||||
toReturn.put("email",inscriptionRequest.getEmail());
|
||||
toReturn.put("birthDate", inscriptionRequest.getBirthDate());
|
||||
toReturn.put("country", inscriptionRequest.getCountry());
|
||||
toReturn.put("curriculum", inscriptionRequest.getCurriculumId());
|
||||
toReturn.put("state", inscriptionRequest.getState());
|
||||
toReturn.put("profilePictureUrl", inscriptionRequest.getProfilePicture());
|
||||
if (toDelete == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
return toReturn;
|
||||
inscriptionServ.delete(toDelete);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,10 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import ovh.herisson.Clyde.Responses.UnauthorizedResponse;
|
||||
import ovh.herisson.Clyde.Services.AuthenticatorService;
|
||||
import ovh.herisson.Clyde.Services.ProtectionService;
|
||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@CrossOrigin(originPatterns = "*", allowCredentials = "true")
|
||||
@ -45,7 +47,10 @@ public class LoginController {
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<InscriptionRequest> register(@RequestBody InscriptionRequest inscriptionRequest){
|
||||
return new ResponseEntity<>(authServ.register(inscriptionRequest), HttpStatus.CREATED);
|
||||
public ResponseEntity<Map<String,Object>> register(@RequestBody InscriptionRequest inscriptionRequest){
|
||||
|
||||
InscriptionRequest returnedInscriptionRequest = authServ.register(inscriptionRequest);
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.requestWithoutPassword(returnedInscriptionRequest), HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
@ -22,16 +22,19 @@ public class MockController {
|
||||
public final CurriculumCourseService CurriculumCourseService;
|
||||
public final CurriculumService curriculumService;
|
||||
public final CourseService courseService;
|
||||
|
||||
public final InscriptionService inscriptionService;
|
||||
ArrayList<User> mockUsers;
|
||||
|
||||
|
||||
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService){
|
||||
public MockController(UserRepository userRepo, TokenRepository tokenRepo, TokenService tokenService, CurriculumCourseService CurriculumCourseService, CurriculumService curriculumService, CourseService courseService, InscriptionService inscriptionService){
|
||||
this.tokenRepo = tokenRepo;
|
||||
this.userRepo = userRepo;
|
||||
this.tokenService = tokenService;
|
||||
this.CurriculumCourseService = CurriculumCourseService;
|
||||
this.curriculumService = curriculumService;
|
||||
this.courseService = courseService;
|
||||
this.inscriptionService = inscriptionService;
|
||||
}
|
||||
|
||||
/** Saves an example of each user type by :
|
||||
@ -87,6 +90,11 @@ public class MockController {
|
||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,commun));
|
||||
CurriculumCourseService.save(new CurriculumCourse(chemistryBab1,chemistry1));
|
||||
|
||||
|
||||
InscriptionRequest inscriptionRequest = new InscriptionRequest("helen","prenom","non","helen@gmail.com","america",new Date(),(long) 1,RequestState.Refused,"yes.png","password");
|
||||
|
||||
inscriptionService.save(inscriptionRequest);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,4 +121,19 @@ public class UserController {
|
||||
|
||||
return new ResponseEntity<>(ProtectionService.usersWithoutPasswords(students), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/user/{id}")
|
||||
public ResponseEntity<String> deleteStudent(@RequestHeader("Authorization") String token, @PathVariable Long id){
|
||||
if (authServ.isNotIn(new Role[]{Role.Admin,Role.Secretary},token))
|
||||
return new UnauthorizedResponse<>(null);
|
||||
|
||||
User toDelete = userService.getUserById(id);
|
||||
|
||||
if (toDelete == null)
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
userService.delete(toDelete);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ public class AuthenticatorService {
|
||||
}
|
||||
|
||||
public InscriptionRequest register(InscriptionRequest inscriptionRequest) {
|
||||
inscriptionRequest.setState(RequestState.Pending);
|
||||
return inscriptionService.save(inscriptionRequest);
|
||||
}
|
||||
|
||||
|
@ -77,4 +77,7 @@ public class CourseService {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void delete(Course course) {
|
||||
courseRepo.delete(course);
|
||||
}
|
||||
}
|
||||
|
@ -19,4 +19,7 @@ public class CurriculumService {
|
||||
return curriculumRepo.findById(id);
|
||||
}
|
||||
|
||||
public void delete(Curriculum curriculum) {
|
||||
curriculumRepo.delete(curriculum);
|
||||
}
|
||||
}
|
@ -87,4 +87,8 @@ public class InscriptionService {
|
||||
save(inscrRequest);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void delete(InscriptionRequest toDelete) {
|
||||
inscriptionRepo.delete(toDelete);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package ovh.herisson.Clyde.Services;
|
||||
|
||||
import ovh.herisson.Clyde.Tables.Course;
|
||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||
import ovh.herisson.Clyde.Tables.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ProtectionService {
|
||||
|
||||
@ -13,6 +15,10 @@ public class ProtectionService {
|
||||
* @return all the user data without the password
|
||||
*/
|
||||
public static HashMap<String,Object> userWithoutPassword(User user){
|
||||
|
||||
if (user ==null)
|
||||
return null;
|
||||
|
||||
HashMap<String,Object> toReturn = new HashMap<>();
|
||||
|
||||
toReturn.put("regNo",user.getRegNo());
|
||||
@ -40,6 +46,9 @@ public class ProtectionService {
|
||||
|
||||
|
||||
public static HashMap<String,Object> courseWithoutPassword(Course course){
|
||||
if (course == null)
|
||||
return null;
|
||||
|
||||
HashMap<String ,Object> toReturn = new HashMap<>();
|
||||
|
||||
toReturn.put("courseId",course.getCourseID());
|
||||
@ -61,5 +70,36 @@ public class ProtectionService {
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> requestWithoutPassword(InscriptionRequest inscriptionRequest) {
|
||||
|
||||
if (inscriptionRequest == null)
|
||||
return null;
|
||||
|
||||
Map<String, Object> toReturn = new HashMap<>();
|
||||
|
||||
toReturn.put("id", inscriptionRequest.getId());
|
||||
toReturn.put("lastName", inscriptionRequest.getLastName());
|
||||
toReturn.put("firstName", inscriptionRequest.getFirstName());
|
||||
toReturn.put("address", inscriptionRequest.getAddress());
|
||||
toReturn.put("email",inscriptionRequest.getEmail());
|
||||
toReturn.put("birthDate", inscriptionRequest.getBirthDate());
|
||||
toReturn.put("country", inscriptionRequest.getCountry());
|
||||
toReturn.put("curriculum", inscriptionRequest.getCurriculumId());
|
||||
toReturn.put("state", inscriptionRequest.getState());
|
||||
toReturn.put("profilePictureUrl", inscriptionRequest.getProfilePicture());
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public static Iterable<Map<String ,Object>> requestsWithoutPasswords(Iterable<InscriptionRequest> inscriptionRequests){
|
||||
|
||||
ArrayList<Map<String,Object>> toReturn = new ArrayList<>();
|
||||
|
||||
for (InscriptionRequest i:inscriptionRequests){
|
||||
toReturn.add(requestWithoutPassword(i));
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -127,4 +127,8 @@ public class UserService {
|
||||
public User getUserById(long id) {
|
||||
return userRepo.findById(id);
|
||||
}
|
||||
|
||||
public void delete(User user) {
|
||||
userRepo.delete(user);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class Course {
|
||||
@ -11,6 +13,7 @@ public class Course {
|
||||
private String title;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.SET_NULL)
|
||||
@JoinColumn(name = "Users")
|
||||
private User owner;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class CurriculumCourse {
|
||||
@ -10,9 +12,11 @@ public class CurriculumCourse {
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "Curriculum")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Curriculum curriculum;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name = "Course")
|
||||
private Course course;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class ReInscriptionRequest {
|
||||
@ -10,10 +12,12 @@ public class ReInscriptionRequest {
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Users")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private User user;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "Curriculum")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Curriculum newCurriculum;
|
||||
private RequestState state;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class TeacherCourse {
|
||||
@ -9,11 +11,13 @@ public class TeacherCourse {
|
||||
private int id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name = "Users")
|
||||
private User user;
|
||||
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name = "Course")
|
||||
private Course course;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -11,6 +13,7 @@ public class Token {
|
||||
private int id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name ="Users")
|
||||
private User user;
|
||||
private String token;
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ovh.herisson.Clyde.Tables;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
@Entity
|
||||
public class UserCurriculum {
|
||||
@ -10,11 +12,13 @@ public class UserCurriculum {
|
||||
|
||||
//Un étudiant peut avoir plusieurs curriculums
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name = "Users")
|
||||
private User user;
|
||||
|
||||
@OneToOne(fetch = FetchType.EAGER)
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "Curriculum")
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
private Curriculum curriculum;
|
||||
|
||||
public UserCurriculum(User user, Curriculum curriculum){
|
||||
|
@ -1,6 +1,5 @@
|
||||
<script setup>
|
||||
import i18n from "@/i18n.js"
|
||||
import Req from "./Request.vue"
|
||||
import {validateRegister, getAllRegisters } from '@/rest/ServiceInscription.js'
|
||||
|
||||
const requests_example = await getAllRegisters();
|
||||
@ -18,8 +17,8 @@
|
||||
<div class="surname"><a>{{item.lastName}}</a></div>
|
||||
<div class="firstname"><a>{{item.firstName}}</a></div>
|
||||
<div class="infos"><button style="background-color:rgb(105,05,105);" >{{i18n("request.moreInfos")}}</button></div>
|
||||
<div class="accept"><button @click="validateRegister(id,Accepted)" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="validateRegister(id,Refused)" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
<div class="accept"><button @click="validateRegister(item.id,'Accepted')" style="background-color:rgb(0,105,50);">{{i18n("request.accept")}}</button></div>
|
||||
<div class="refuse"><button @click="validateRegister(item.id,Refused)" style="background-color:rgb(105,0,0);">{{i18n("request.refuse")}}</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import {reactive, ref } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
import { login , register , disconnect, isLogged} from '@/rest/Users.js'
|
||||
import { getAllCurriculums } from '@/rest/curriculum.js'
|
||||
@ -10,17 +10,20 @@
|
||||
|
||||
const loginPage= ref(true)
|
||||
const page = ref(0)
|
||||
|
||||
const outputs = reactive({
|
||||
surname:null,
|
||||
firstname:null,
|
||||
password:null,
|
||||
birthday:null,
|
||||
email:null,
|
||||
address:null,
|
||||
country:null,
|
||||
curriculum:null,
|
||||
})
|
||||
|
||||
const submitValue= ref(i18n("login.guest.submit"))
|
||||
const surname=ref("")
|
||||
const firstname=ref("")
|
||||
const password=ref("")
|
||||
const passwordConfirm=ref("")
|
||||
const birthday=ref("")
|
||||
const email=ref("")
|
||||
const address=ref("")
|
||||
const country=ref("")
|
||||
let curriculum;
|
||||
|
||||
const imageSaved = ref(false)
|
||||
const ppData = ref(false)
|
||||
@ -32,8 +35,9 @@
|
||||
window.location.href="#/home";
|
||||
}, "500");
|
||||
}
|
||||
function verifyInputs(){
|
||||
if(password.value==passwordConfirm.value){
|
||||
function verifyInputs(pass){
|
||||
console.log(pass)
|
||||
if(pass==passwordConfirm.value){
|
||||
page.value++;
|
||||
return toast('Password and Confirm Password are correct.', {
|
||||
|
||||
@ -56,17 +60,17 @@
|
||||
<div class='loginBox'>
|
||||
|
||||
<div v-if="loginPage">
|
||||
<form @submit.prevent=" login(email,password);goBackHome();"class="form">
|
||||
<form @submit.prevent=" login(outputs.email,outputs.password);goBackHome();"class="form">
|
||||
<h1 style="color:rgb(239,60,168); font-family: sans-serif;">
|
||||
{{i18n("login.guest.signin")}}
|
||||
</h1>
|
||||
<div class="inputBox">
|
||||
<p>ID / {{i18n("login.guest.email")}}</p>
|
||||
<input type="text" v-model="email">
|
||||
<input type="text" v-model="outputs.email">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.password")}}</p>
|
||||
<input type="password" v-model="password">
|
||||
<input type="password" v-model="outputs.password">
|
||||
</div>
|
||||
<div class="register">
|
||||
<a @click="loginPage=!loginPage">{{i18n("login.guest.register")}}</a>
|
||||
@ -85,19 +89,19 @@
|
||||
<div v-if="page === 0">
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.surname")}}</p>
|
||||
<input type="text" v-model="surname">
|
||||
<input type="text" v-model="outputs.surname">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.firstname")}}</p>
|
||||
<input type="text" v-model="firstname">
|
||||
<input type="text" v-model="outputs.firstname">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.birthday")}}</p>
|
||||
<input type="date" v-model="birthday">
|
||||
<input type="date" v-model="outputs.birthday">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.password")}}</p>
|
||||
<input type="password" v-model="password">
|
||||
<input type="password" v-model="outputs.password">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.confirm")}} {{i18n("login.guest.password")}}</p>
|
||||
@ -105,7 +109,7 @@
|
||||
</div>
|
||||
|
||||
<div class="switchpage">
|
||||
<button @click="verifyInputs();">{{i18n("login.guest.nextpage")}}</button>
|
||||
<button @click="verifyInputs(outputs.password);">{{i18n("login.guest.nextpage")}}</button>
|
||||
|
||||
</div>
|
||||
<div @click="(loginPage=!loginPage) && (page=0)" class="register">
|
||||
@ -115,15 +119,15 @@
|
||||
<div v-else>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.email")}}</p>
|
||||
<input type="mail" v-model="email">
|
||||
<input type="mail" v-model="outputs.email">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.address")}}</p>
|
||||
<input type="text" v-model="address">
|
||||
<input type="text" v-model="outputs.address">
|
||||
</div>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("login.guest.country")}}</p>
|
||||
<input type="text" v-model="country">
|
||||
<input type="text" v-model="outputs.country">
|
||||
</div>
|
||||
<form novalidate enctype="multipart/form-data" class="inputBox">
|
||||
<p>{{i18n("profile.picture").toUpperCase()}}</p>
|
||||
@ -131,13 +135,13 @@
|
||||
</form>
|
||||
<div class="inputBox">
|
||||
<p>{{i18n("Curriculum").toUpperCase()}}</p>
|
||||
<select v-model="curriculum">
|
||||
<select v-model="outputs.curriculum">
|
||||
<option v-for="item in curricula">{{item.curriculumId}}</option>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div style="align-self:center;" class="inputBox">
|
||||
<button style="margin-top:25px;" @click="console.log(curriculum);register(firstname, surname, birthday, password, mail, address, country, curriculum);">
|
||||
<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);">
|
||||
{{i18n("login.guest.submit")}}
|
||||
</button>
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* TODO: On time of writing, the backend doesn't support these endpoints so it could be modified in the future.
|
||||
*/
|
||||
import {restGet, restPatch} from './restConsumer.js'
|
||||
import {restGet, restPatch,restPatchInfo} from './restConsumer.js'
|
||||
|
||||
/**
|
||||
* create a new register requests that can be recovered by the registering service
|
||||
@ -41,5 +41,5 @@ export async function getAllRegisters(){
|
||||
* Change the state of a requests.
|
||||
*/
|
||||
export async function validateRegister(id, state){
|
||||
return restPatch("/request/register/" + id, {state: state});
|
||||
return restPatch("/request/register/" + id, state);
|
||||
}
|
||||
|
@ -28,14 +28,15 @@ export function disconnect(){
|
||||
*/
|
||||
export async function register(firstname, lastname, birthDate, password, email, address, country, curriculumId, imageId){
|
||||
return restPost("/register", {
|
||||
firstname: firstname,
|
||||
lastname: lastname,
|
||||
firstName: firstname,
|
||||
lastName: lastname,
|
||||
birthDate: birthDate,
|
||||
password: password,
|
||||
email: email,
|
||||
address: address,
|
||||
country: country,
|
||||
curriculumId: curriculumId
|
||||
curriculumId: curriculumId,
|
||||
profilePictureUrl: imageId,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ export async function restPost(endPoint, data) {
|
||||
return await _rest(endPoint, {method: "POST", credentials: 'include', body: JSON.stringify(data)});
|
||||
}
|
||||
|
||||
|
||||
export async function restPostFile(endPoint, file){
|
||||
let headers = new Headers();
|
||||
return await _rest(endPoint, {method: "POST", credentials: 'include', body: file, headers: headers });
|
||||
@ -24,6 +25,10 @@ export async function restPatch(endPoint, data) {
|
||||
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: JSON.stringify(data)});
|
||||
}
|
||||
|
||||
export async function restPatchInfo(endPoint, data){
|
||||
return await _rest(endPoint, {method: "PATCH", credentials: 'include', body: data});
|
||||
}
|
||||
|
||||
/**
|
||||
* backbone for the request made by the frontend
|
||||
*
|
||||
|