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
if ($status_restricted) {
$applicant = DB::table('applicant')->where('applicant_id', $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')
->where('fk_status', 'Valide')
->first();
} else {
$applicant = DB::table('applicant')->where('applicant_id', $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')
->first();
}
......
......@@ -12,21 +12,20 @@ class JwtMiddleware
{
$token = str_replace('Bearer ', '', $request->headers->get('Authorization'));
if (!$token) {
if ($token == 'null') {
return response()->json([
'error' => 'Token not provided.'
'error' => 'Connexion requise'
], 401);
}
try {
$content = JWT::decode($token, env('JWT_SECRET'), ['HS256']);
} catch (ExpiredException $e) {
return response()->json([
'error' => 'Provided token is expired.'
'error' => 'Session expirée'
], 400);
} catch (Exception $e) {
echo $e;
return response()->json([
'error' => 'An error while decoding token.'
'error' => 'Error while decoding token'
], 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 @@
<v-toolbar-title>Canap-Gest</v-toolbar-title>
<v-spacer></v-spacer>
<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-icon @click="login">account_circle</v-icon>
</v-btn>
......@@ -38,7 +36,7 @@ export default {
this.$store.dispatch('moduleUser/login')
},
logout() {
this.$store.dispatch('moduleUser/logout')
this.$store.dispatch('moduleUser/logout', true)
}
},
}
......
......@@ -9,10 +9,18 @@ const instance = axios.create({
instance.interceptors.response.use(function (response) {
return response;
}, function (error) {
// Affichage des erreurs (snackbar)
Object.values(error.response.data).forEach(errMsg => {
store.commit('moduleSnackbar/toggle', { open: true, message: errMsg[0], type: 'error' }, { root: true })
})
if (!error.response) {
store.commit('moduleSnackbar/toggle', { open: true, message: 'API non atteignable', type: 'warning' }, { 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)
})
......
......@@ -11,13 +11,16 @@ export function getApplications(context) {
}
export function getCurrentApplicationData(context, data) {
axios({
method: 'get',
url: '/applicant/' + data.id
})
.then(response => {
context.commit('setCurrentApplicationData', response.data.personal_data)
return new Promise((resolve) => {
axios({
method: 'get',
url: '/applicant/' + data.id
})
.then(response => {
context.commit('setCurrentApplicationData', response.data)
resolve()
})
})
}
export function getCurrentApplicationComments(context, data) {
......
......@@ -16,9 +16,11 @@ export function login() {
})
}
export function logout() {
export function logout(context, fullLogout) {
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 default {
userData: {
tequila: {
firstname: String,
name: String,
firstname: '',
name: '',
group: String,
user: String,
sciper: String
},
role: String,
role: '',
permissions: []
},
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