diff --git a/admin/api/password.go b/admin/api/password.go index 1941df38..d37153e9 100644 --- a/admin/api/password.go +++ b/admin/api/password.go @@ -8,7 +8,6 @@ import ( "net/http" "os" "path" - "strings" "text/template" "unicode" @@ -242,7 +241,7 @@ func genDexConfig() ([]byte, error) { logoPath := "" if len(challengeInfo.MainLogo) > 0 { - logoPath = strings.Replace(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1], "$FILES$", fic.FilesDir, -1) + logoPath = path.Join("../../files", "logo", path.Base(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1])) } dexTmpl, err := template.New("dexcfg").Parse(dexcfgtpl) @@ -286,6 +285,11 @@ func genDexConfig() ([]byte, error) { } func genDexPasswordTpl() ([]byte, error) { + challengeInfo, err := GetChallengeInfo() + if err != nil { + return nil, fmt.Errorf("Cannot create template: %w", err) + } + if teams, err := fic.GetTeams(); err != nil { return nil, err } else { @@ -295,6 +299,7 @@ func genDexPasswordTpl() ([]byte, error) { return nil, fmt.Errorf("Cannot create template: %w", err) } else if err = dexTmpl.Execute(b, dexConfig{ Teams: teams, + Name: challengeInfo.Title, }); err != nil { return nil, fmt.Errorf("An error occurs during template execution: %w", err) } else { diff --git a/admin/static/js/app.js b/admin/static/js/app.js index 19a3f518..173df8b1 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -958,12 +958,13 @@ angular.module("FICApp") }) .controller("OAuthController", function ($scope, $http) { + $scope.oauth_status = {}; $scope.refreshOAuthStatus = function () { $http.get("api/oauth-status").then(function (res) { - $scope.oauth_status = response.data; + $scope.oauth_status = res.data; }); - }; + $scope.refreshOAuthStatus(); $scope.genDexCfg = function () { $http.post("api/dex.yaml").then(function () { diff --git a/admin/static/views/sync.html b/admin/static/views/sync.html index 886a28cd..06d8e84f 100644 --- a/admin/static/views/sync.html +++ b/admin/static/views/sync.html @@ -58,7 +58,6 @@ diff --git a/admin/sync/exercice_files.go b/admin/sync/exercice_files.go index 276a72e4..11afe1ff 100644 --- a/admin/sync/exercice_files.go +++ b/admin/sync/exercice_files.go @@ -363,7 +363,7 @@ func SyncExerciceFiles(i Importer, exercice *fic.Exercice, exceptions *CheckExce var f interface{} - if pf, exists := paramsFiles[fname]; exists && pf.URL != "" { + if pf, exists := paramsFiles[fname]; exists && pf.URL != "" && !i.Exists(path.Join(exercice.Path, "files", fname)) { dest := GetDestinationFilePath(pf.URL, &pf.Filename) if _, err := os.Stat(dest); !os.IsNotExist(err) { diff --git a/frontend/fic/src/lib/components/ExerciceFlags.svelte b/frontend/fic/src/lib/components/ExerciceFlags.svelte index c5c8e24c..260734a9 100644 --- a/frontend/fic/src/lib/components/ExerciceFlags.svelte +++ b/frontend/fic/src/lib/components/ExerciceFlags.svelte @@ -39,16 +39,21 @@ submissions.update((u) => { for (const k in last_submission.flags) { - u.flags[k] = last_submission.flags[k]; + if (last_submission.flags[k]) + u.flags[k] = last_submission.flags[k]; } for (const k in last_submission.mcqs) { - u.mcqs[k] = last_submission.mcqs[k]; + if (last_submission.mcqs[k]) + u.mcqs[k] = last_submission.mcqs[k]; } for (const k in last_submission.justifications) { - u.justifications[k] = last_submission.justifications[k]; + if (last_submission.justifications[k]) + u.justifications[k] = last_submission.justifications[k]; } + + return u; }) if ($my && $my.team_id === 0) {