feat(be): sort oauth providers

This commit is contained in:
fiftin 2024-03-11 15:17:53 +01:00
parent 678260970f
commit 123135dd9d
4 changed files with 24 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"net/http"
"net/url"
"os"
"sort"
"strconv"
"strings"
"time"
@ -212,6 +213,7 @@ func login(w http.ResponseWriter, r *http.Request) {
LoginWithPassword: !util.Config.PasswordLoginDisable,
}
i := 0
for k, v := range util.Config.OidcProviders {
config.OidcProviders[i] = loginMetadataOidcProvider{
ID: k,
@ -221,6 +223,13 @@ func login(w http.ResponseWriter, r *http.Request) {
}
i++
}
sort.Slice(config.OidcProviders, func(i, j int) bool {
a := util.Config.OidcProviders[config.OidcProviders[i].ID]
b := util.Config.OidcProviders[config.OidcProviders[j].ID]
return a.Order < b.Order
})
helpers.WriteJSON(w, http.StatusOK, config)
return
}

View File

@ -75,6 +75,7 @@ type OidcProvider struct {
NameClaim string `json:"name_claim" default:"preferred_username"`
EmailClaim string `json:"email_claim" default:"email"`
EmailSuffix string `json:"email_suffix"`
Order int `json:"order"`
}
const (

View File

@ -773,6 +773,9 @@ export default {
},
project() {
if (this.projects == null) {
return null;
}
return this.projects.find((x) => x.id === this.projectId);
},

View File

@ -77,8 +77,18 @@
ref="signInForm"
lazy-validation
v-model="signInFormValid"
style="width: 300px; height: 300px;"
style="width: 300px;"
>
<v-img
width="80"
height="80"
transition="0"
src="favicon.png"
style="margin: auto;"
class="mb-4"
/>
<h3 class="text-center mb-8">{{ $t('semaphore') }}</h3>
<v-alert