mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 13:14:24 +08:00
make sure auth secret is set only once
This commit is contained in:
parent
ba33ed02aa
commit
920ac4c507
2 changed files with 3 additions and 3 deletions
|
@ -75,7 +75,7 @@ func InitializeAuthProvider() string {
|
|||
return ""
|
||||
}
|
||||
logger.Log(0, "setting oauth secret")
|
||||
var err = logic.SetAuthSecret(auth_key, logic.RandomString(64))
|
||||
var err = logic.SetAuthSecret(logic.RandomString(64))
|
||||
if err != nil {
|
||||
logger.FatalLog("failed to set auth_secret", err.Error())
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ func DeleteUser(user string) (bool, error) {
|
|||
return true, nil
|
||||
}
|
||||
|
||||
func SetAuthSecret(key, secret string) error {
|
||||
func SetAuthSecret(secret string) error {
|
||||
type valueHolder struct {
|
||||
Value string `json:"value" bson:"value"`
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ func SetAuthSecret(key, secret string) error {
|
|||
Value: b64NewValue,
|
||||
}
|
||||
d, _ := json.Marshal(newValueHolder)
|
||||
return database.Insert(key, string(d), database.GENERATED_TABLE_NAME)
|
||||
return database.Insert(auth_key, string(d), database.GENERATED_TABLE_NAME)
|
||||
}
|
||||
|
||||
// FetchAuthSecret - manages secrets for oauth
|
||||
|
|
Loading…
Add table
Reference in a new issue