dnote/pkg/server/session/session.go
Sung Won Cho 6acc2936e3
Reduce bundle size (#469)
* 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
2020-05-22 16:30:05 +10:00

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,
}
}