Fix connection through Kerberos
continuous-integration/drone/push Build is running Details

This commit is contained in:
nemunaire 2022-09-07 20:54:04 +02:00
parent b572938283
commit 60540a1631
2 changed files with 30 additions and 22 deletions

View File

@ -80,5 +80,10 @@ func checkAuthKrb5(c *gin.Context) {
return
}
completeAuth(c, lf.Login, lf.Login+"@epita.fr", "", "", "", nil)
if usr, err := completeAuth(c, lf.Login, lf.Login+"@epita.fr", "", "", "", nil); err != nil {
c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"errmsg": err.Error()})
return
} else {
c.JSON(http.StatusOK, authToken{User: usr, CurrentPromo: currentPromo})
}
}

View File

@ -3,6 +3,7 @@
import { page } from '$app/stores'
import AuthButton from '../components/AuthButton.svelte';
import { ToastsStore } from '../stores/toasts';
import { user } from '../stores/user';
let auth = { username: "", password: "" };
@ -17,23 +18,25 @@
body: JSON.stringify(auth),
})
.then((response) => {
response.json().then((auth) => {
if (response.status == 200) {
response.json().then((auth) => {
pleaseWait = false;
if (next && next.indexOf('//') === -1) {
goto(next)
} else {
goto(".");
}
})
} else {
pleaseWait = false;
if (next && next.indexOf('//') === -1) {
goto(next)
} else {
goto(".");
}
})
})
.catch((response) => {
pleaseWait = false;
if (response.data)
ToastsStore.addToast({
color: "danger",
title: "Connexion impossible",
msg: (response.data ? response.data.errmsg : "Impossible de contacter le serveur"),
});
response.json().then((data) => {
ToastsStore.addToast({
color: "danger",
title: "Connexion impossible",
msg: (data ? data.errmsg : "Impossible de contacter le serveur"),
});
});
}
});
}
@ -51,13 +54,13 @@
<div class="row">
<form class="col" on:submit|preventDefault={logmein}>
<h2>Accès à votre compte</h2>
<div class="mb-3">
<label for="login" class="form-label">CRI login</label>
<input class="form-control" id="login" bind:value={auth.username} placeholder="Entrer votre login" autofocus>
<div class="form-floating mb-3">
<input type="text" class="form-control" id="login" bind:value={auth.username} placeholder="xavier.login" autofocus>
<label for="login">CRI login</label>
</div>
<div class="mb-3">
<label for="password" class="form-label">Mot de passe</label>
<div class="form-floating mb-3">
<input type="password" class="form-control" id="password" bind:value={auth.password} placeholder="Mot de passe">
<label for="password">Mot de passe</label>
</div>
<button type="submit" class="btn btn-info">
{#if pleaseWait}