mirror of
https://github.com/dnote/dnote
synced 2026-03-15 23:15:50 +01:00
* Rename handlers to api * Fix imports * Fix test * Abstract * Fix warning * wip * Split session * Pass db * Fix test * Fix test * Remove payment * Fix state * Fix flow * Check password when changing email * Add test methods * Fix timestamp * Document * Remove clutter * Redirect to login * Fix * Fix
23 lines
560 B
Go
23 lines
560 B
Go
package session
|
|
|
|
import (
|
|
"github.com/dnote/dnote/pkg/server/database"
|
|
)
|
|
|
|
// Session represents user session
|
|
type Session struct {
|
|
UUID string `json:"uuid"`
|
|
Email string `json:"email"`
|
|
EmailVerified bool `json:"email_verified"`
|
|
Pro bool `json:"pro"`
|
|
}
|
|
|
|
// New returns a new session for the given user
|
|
func New(user database.User, account database.Account) Session {
|
|
return Session{
|
|
UUID: user.UUID,
|
|
Pro: user.Cloud,
|
|
Email: account.Email.String,
|
|
EmailVerified: account.EmailVerified,
|
|
}
|
|
}
|