Skip to content

Commit

Permalink
More robust local dev experience
Browse files Browse the repository at this point in the history
  • Loading branch information
laszlocph committed Nov 12, 2024
1 parent 422eafc commit 11ee5a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/dashboard/server/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,18 @@ func getOrCreateUser(store *store.Store, scmUser *scm.User, token *login.Token)
}

func setSessionCookie(w http.ResponseWriter, r *http.Request, user *model.User) error {
fortyEightHours, _ := time.ParseDuration("48h")
exp := time.Now().Add(fortyEightHours).Unix()
t := token.New(token.SessToken, user.Login, "")
tokenStr, err := t.SignExpires(user.Secret, exp)
tokenStr, err := generateSessionCookie(user.Login, user.Secret)
if err != nil {
return err
}

httputil.SetCookie(w, r, "user_sess", tokenStr)
return nil
}

func generateSessionCookie(user, secret string) (string, error) {
fortyEightHours, _ := time.ParseDuration("48h")
exp := time.Now().Add(fortyEightHours).Unix()
t := token.New(token.SessToken, user, "")
return t.SignExpires(secret, exp)
}
4 changes: 4 additions & 0 deletions web/src/views/envConfig/databasesTab.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export function DatabasesTab(props) {
const dependency = dependencies[id]
const module = dependencyCatalog.find(m => m.reference.chart.repository === dependency.chart.repository)

if (!module) {
return null
}

return (
<div key={id} className='relative'>
<button onClick={() => deleteDependency(id)} className="destructiveButtonSecondary absolute top-6 right-6">Delete</button>
Expand Down

0 comments on commit 11ee5a8

Please sign in to comment.