diff --git a/servicio-usuarios/src/schemas/user.schema.ts b/servicio-usuarios/src/schemas/user.schema.ts
index 160a5951..e9fa6dd7 100644
--- a/servicio-usuarios/src/schemas/user.schema.ts
+++ b/servicio-usuarios/src/schemas/user.schema.ts
@@ -10,7 +10,7 @@ export class User {
@Prop({index: true})
dni!: string;
- @Prop({required: true})
+ @Prop()
name: string;
@Prop({required: true})
diff --git a/servicio-usuarios/src/users/users.service.ts b/servicio-usuarios/src/users/users.service.ts
index b9e289a1..32e5125d 100644
--- a/servicio-usuarios/src/users/users.service.ts
+++ b/servicio-usuarios/src/users/users.service.ts
@@ -29,7 +29,7 @@ export class UsersService {
let passwordEncriptada = Md5.init(user.password);
user.password = passwordEncriptada;
- this.userModel.create(user)
+ this.userModel.create(user);
let community = await this.findCommunity(user.community_id);
@@ -98,10 +98,12 @@ export class UsersService {
if (err) {
reject(err);
} else {
+ console.log(res);
+ console.log(Md5.init(password));
let passwordEncriptada = Md5.init(password);
if (res[0].password == passwordEncriptada) {
resolve(res[0]);
- console.log(res[0])
+ res[0].token = '1234';
} else {
resolve(null);
}
diff --git a/web-ui/web-react/src/App.js b/web-ui/web-react/src/App.js
index 01c0e9ac..f9e077b6 100644
--- a/web-ui/web-react/src/App.js
+++ b/web-ui/web-react/src/App.js
@@ -53,6 +53,17 @@ import './App.scss';
import LogIn from './components/LogIn';
import { PrimeIcons } from 'primereact/api';
import AreasComunes from './components/AreasComunes';
+import { Cookies } from 'react-cookie';
+import useToken from './components/useToken';
+
+function setToken(userToken) {
+ sessionStorage.setItem('token', JSON.stringify(userToken.token));
+}
+function getToken() {
+ const tokenString = sessionStorage.getItem('token');
+ const userToken = JSON.parse(tokenString);
+ return userToken?.token
+}
const App = () => {
@@ -66,6 +77,9 @@ const App = () => {
const [mobileTopbarMenuActive, setMobileTopbarMenuActive] = useState(false);
const copyTooltipRef = useRef();
const location = useLocation();
+
+
+ const { token, setToken } = useToken();
PrimeReact.ripple = true;
@@ -351,7 +365,6 @@ const App = () => {
});
- const [token, setToken] = useState();
if(!token) {
return