Skip to content
Snippets Groups Projects
Commit 005ea1ba authored by nicrausaz's avatar nicrausaz
Browse files

Vue candidature

parent ec99566c
No related branches found
No related tags found
No related merge requests found
Showing
with 464 additions and 46 deletions
...@@ -135,12 +135,14 @@ class ApplicantsController extends Controller ...@@ -135,12 +135,14 @@ class ApplicantsController extends Controller
if ($status_restricted) { if ($status_restricted) {
$applicant = DB::table('applicant')->where('applicant_id', $id) $applicant = DB::table('applicant')->where('applicant_id', $id)
->join('position', 'applicant.fk_position', '=', 'position.position_id') ->join('position', 'applicant.fk_position', '=', 'position.position_id')
->join('location', 'position.fk_location', '=', 'location.location_id')
->join('job', 'position.fk_job', '=', 'job.job_id') ->join('job', 'position.fk_job', '=', 'job.job_id')
->where('fk_status', 'Valide') ->where('fk_status', 'Valide')
->first(); ->first();
} else { } else {
$applicant = DB::table('applicant')->where('applicant_id', $id) $applicant = DB::table('applicant')->where('applicant_id', $id)
->join('position', 'applicant.fk_position', '=', 'position.position_id') ->join('position', 'applicant.fk_position', '=', 'position.position_id')
->join('location', 'position.fk_location', '=', 'location.location_id')
->join('job', 'position.fk_job', '=', 'job.job_id') ->join('job', 'position.fk_job', '=', 'job.job_id')
->first(); ->first();
} }
......
...@@ -12,21 +12,20 @@ class JwtMiddleware ...@@ -12,21 +12,20 @@ class JwtMiddleware
{ {
$token = str_replace('Bearer ', '', $request->headers->get('Authorization')); $token = str_replace('Bearer ', '', $request->headers->get('Authorization'));
if (!$token) { if ($token == 'null') {
return response()->json([ return response()->json([
'error' => 'Token not provided.' 'error' => 'Connexion requise'
], 401); ], 401);
} }
try { try {
$content = JWT::decode($token, env('JWT_SECRET'), ['HS256']); $content = JWT::decode($token, env('JWT_SECRET'), ['HS256']);
} catch (ExpiredException $e) { } catch (ExpiredException $e) {
return response()->json([ return response()->json([
'error' => 'Provided token is expired.' 'error' => 'Session expirée'
], 400); ], 400);
} catch (Exception $e) { } catch (Exception $e) {
echo $e;
return response()->json([ return response()->json([
'error' => 'An error while decoding token.' 'error' => 'Error while decoding token'
], 400); ], 400);
} }
......
No preview for this file type
No preview for this file type
No preview for this file type
canapGEST/Site/src/assets/english_logo.png

2.76 KiB

canapGEST/Site/src/assets/french_logo.png

1.83 KiB

canapGEST/Site/src/assets/german_logo.png

1.73 KiB

canapGEST/Site/src/assets/others_logo.png

3.1 KiB

...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
<v-toolbar-title>Canap-Gest</v-toolbar-title> <v-toolbar-title>Canap-Gest</v-toolbar-title>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-toolbar-items class="hidden-sm-and-down" v-if="!isLoged"> <v-toolbar-items class="hidden-sm-and-down" v-if="!isLoged">
<v-btn flat class="white--text">Link One</v-btn>
<v-btn flat class="white--text">Link Two</v-btn>
<v-btn icon class="white--text"> <v-btn icon class="white--text">
<v-icon @click="login">account_circle</v-icon> <v-icon @click="login">account_circle</v-icon>
</v-btn> </v-btn>
...@@ -38,7 +36,7 @@ export default { ...@@ -38,7 +36,7 @@ export default {
this.$store.dispatch('moduleUser/login') this.$store.dispatch('moduleUser/login')
}, },
logout() { logout() {
this.$store.dispatch('moduleUser/logout') this.$store.dispatch('moduleUser/logout', true)
} }
}, },
} }
......
...@@ -9,10 +9,18 @@ const instance = axios.create({ ...@@ -9,10 +9,18 @@ const instance = axios.create({
instance.interceptors.response.use(function (response) { instance.interceptors.response.use(function (response) {
return response; return response;
}, function (error) { }, function (error) {
// Affichage des erreurs (snackbar) if (!error.response) {
Object.values(error.response.data).forEach(errMsg => { store.commit('moduleSnackbar/toggle', { open: true, message: 'API non atteignable', type: 'warning' }, { root: true })
store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true }) } else if (error.response.status == 400 || error.response.status == 401) {
}) // Erreur de token
store.commit('moduleSnackbar/toggle', { open: true, message: error.response.data.error, type: 'warning' }, { root: true })
store.dispatch('moduleUser/logout', false)
} else {
// Affichage des erreurs (snackbar)
Object.values(error.response.data).forEach(errMsg => {
store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true })
})
}
return Promise.reject(error) return Promise.reject(error)
}) })
......
...@@ -11,13 +11,16 @@ export function getApplications(context) { ...@@ -11,13 +11,16 @@ export function getApplications(context) {
} }
export function getCurrentApplicationData(context, data) { export function getCurrentApplicationData(context, data) {
axios({ return new Promise((resolve) => {
method: 'get', axios({
url: '/applicant/' + data.id method: 'get',
}) url: '/applicant/' + data.id
.then(response => {
context.commit('setCurrentApplicationData', response.data.personal_data)
}) })
.then(response => {
context.commit('setCurrentApplicationData', response.data)
resolve()
})
})
} }
export function getCurrentApplicationComments(context, data) { export function getCurrentApplicationComments(context, data) {
......
...@@ -16,9 +16,11 @@ export function login() { ...@@ -16,9 +16,11 @@ export function login() {
}) })
} }
export function logout() { export function logout(context, fullLogout) {
localStorage.removeItem('stored_token'); localStorage.removeItem('stored_token');
window.location = 'https://tequila.epfl.ch/logout' if (fullLogout) {
window.location = 'https://tequila.epfl.ch/logout'
}
} }
export function getUserData(context) { export function getUserData(context) {
......
export default { export default {
userData: { userData: {
tequila: { tequila: {
firstname: String, firstname: '',
name: String, name: '',
group: String, group: String,
user: String, user: String,
sciper: String sciper: String
}, },
role: String, role: '',
permissions: [] permissions: []
}, },
permittedJobs: [] permittedJobs: []
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment