diff --git a/admin/api/password.go b/admin/api/password.go index d37153e9..1941df38 100644 --- a/admin/api/password.go +++ b/admin/api/password.go @@ -8,6 +8,7 @@ import ( "net/http" "os" "path" + "strings" "text/template" "unicode" @@ -241,7 +242,7 @@ func genDexConfig() ([]byte, error) { logoPath := "" if len(challengeInfo.MainLogo) > 0 { - logoPath = path.Join("../../files", "logo", path.Base(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1])) + logoPath = strings.Replace(challengeInfo.MainLogo[len(challengeInfo.MainLogo)-1], "$FILES$", fic.FilesDir, -1) } dexTmpl, err := template.New("dexcfg").Parse(dexcfgtpl) @@ -285,11 +286,6 @@ 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 { @@ -299,7 +295,6 @@ 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 173df8b1..19a3f518 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -958,13 +958,12 @@ 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 = res.data; + $scope.oauth_status = response.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 06d8e84f..886a28cd 100644 --- a/admin/static/views/sync.html +++ b/admin/static/views/sync.html @@ -58,6 +58,7 @@
diff --git a/admin/sync/exercice_files.go b/admin/sync/exercice_files.go index 11afe1ff..276a72e4 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 != "" && !i.Exists(path.Join(exercice.Path, "files", fname)) { + if pf, exists := paramsFiles[fname]; exists && pf.URL != "" { 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 260734a9..c5c8e24c 100644 --- a/frontend/fic/src/lib/components/ExerciceFlags.svelte +++ b/frontend/fic/src/lib/components/ExerciceFlags.svelte @@ -39,21 +39,16 @@ submissions.update((u) => { for (const k in last_submission.flags) { - if (last_submission.flags[k]) - u.flags[k] = last_submission.flags[k]; + u.flags[k] = last_submission.flags[k]; } for (const k in last_submission.mcqs) { - if (last_submission.mcqs[k]) - u.mcqs[k] = last_submission.mcqs[k]; + u.mcqs[k] = last_submission.mcqs[k]; } for (const k in last_submission.justifications) { - if (last_submission.justifications[k]) - u.justifications[k] = last_submission.justifications[k]; + u.justifications[k] = last_submission.justifications[k]; } - - return u; }) if ($my && $my.team_id === 0) {