Documentation ¶
Index ¶
- func GetGitHubClient(token oauth2.Token) (*github.Client, error)
- func SetDevConfig(config *Config)
- type App
- func (a *App) Clone() *App
- func (a *App) Config() Config
- func (a *App) CreateAndStoreResetPasswordToken(email string) (*model.Token, error)
- func (a *App) CreateAndStoreVerifyEmailToken(email string) (*model.Token, error)
- func (a *App) CreateOAuthState() (*model.OAuthState, error)
- func (a *App) GetHTMLTemplate(templateName string) *HTMLTemplate
- func (a *App) GetOAuthConfig() *oauth2.Config
- func (a *App) GetOAuthState(idOrToken string) (*model.OAuthState, error)
- func (a *App) GithubConnectToken(token oauth2.Token) (*github.Client, error)
- func (a *App) HTMLTemplates() *template.Template
- func (a *App) Logger() logrus.FieldLogger
- func (a *App) ReloadHTMLTemplates() error
- func (a *App) SendMail(to, subject, htmlBody string, sendBcc bool) error
- func (a *App) SendMailWithAttachments(to, subject, htmlBody string, sendBcc bool, attachments []*email.Attachment) error
- func (a *App) SendPasswordResetEmail(email, siteURL string, token *model.Token) error
- func (a *App) SendTestEmail(userEmail, siteURL string) error
- func (a *App) SendVerifyEmailEmail(email, siteURL string, token *model.Token) error
- func (a *App) Store() store.Store
- func (a *App) User() UserService
- type Config
- type GithubOAuth
- type HTMLTemplate
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDevConfig ¶
func SetDevConfig(config *Config)
SetDevConfig create config for local dev mode.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App contains all the business logic as methods.
func NewApp ¶
func NewApp(logger logrus.FieldLogger, store store.Store, config Config, userService UserService) *App
NewApp creates a new instance of App
func (*App) CreateAndStoreResetPasswordToken ¶
CreateAndStoreResetPasswordToken creates a new password reset token and stores it.
func (*App) CreateAndStoreVerifyEmailToken ¶
CreateAndStoreVerifyEmailToken creates a new verify email token and stores it.
func (*App) CreateOAuthState ¶
func (a *App) CreateOAuthState() (*model.OAuthState, error)
func (*App) GetHTMLTemplate ¶
func (a *App) GetHTMLTemplate(templateName string) *HTMLTemplate
GetHTMLTemplate returns the HTMLTemplate of a give name.
func (*App) GetOAuthConfig ¶
func (*App) GetOAuthState ¶
func (a *App) GetOAuthState(idOrToken string) (*model.OAuthState, error)
func (*App) GithubConnectToken ¶
func (*App) HTMLTemplates ¶
HTMLTemplates is an accessor for the app html templates.
func (*App) Logger ¶
func (a *App) Logger() logrus.FieldLogger
func (*App) ReloadHTMLTemplates ¶
ReloadHTMLTemplates refreshes the in-memory HTML templates.
func (*App) SendMailWithAttachments ¶
func (a *App) SendMailWithAttachments(to, subject, htmlBody string, sendBcc bool, attachments []*email.Attachment) error
SendEmailWithAttachments would send the email including the passed attachments
func (*App) SendPasswordResetEmail ¶
SendPasswordResetEmail sends a password reset email.
func (*App) SendTestEmail ¶
SendTestEmail creates and sends a test email.
func (*App) SendVerifyEmailEmail ¶
SendVerifyEmailEmail sends a verify-email email.
type Config ¶
type Config struct { // the location to which a user might point their browser SiteURL string // the location to which the API should be called if is different than SiteURL APIURL string // Github OAuth configuration GithubOAuth GithubOAuth // email server related configuration Email email.Config // developer mode Dev bool }
Config is the config used by the dashboard server app.
type GithubOAuth ¶
type HTMLTemplate ¶
type HTMLTemplate struct { Template *template.Template TemplateName string Props map[string]interface{} }
HTMLTemplate is a wrapper for specifying and rendering a given HTML template.
func (*HTMLTemplate) Render ¶
func (t *HTMLTemplate) Render() (string, error)
Render renders the HTMLTemplate to a string.
func (*HTMLTemplate) RenderToWriter ¶
func (t *HTMLTemplate) RenderToWriter(w io.Writer) error
RenderToWriter renders the template of the given name to the provided reader.
func (*HTMLTemplate) SetBaseProps ¶
func (t *HTMLTemplate) SetBaseProps()
SetBaseProps sets common prop values for most email templates.
type UserService ¶
type UserService interface { Create(user *model.User) (*model.User, error) Get(id string) (*model.User, error) GetByEmail(email string) (*model.User, error) Update(user *model.User) (*model.User, error) AuthenticateUserForLogin(email, password string) (*model.User, error) Login(w http.ResponseWriter, r *http.Request, user *model.User) error Logout(w http.ResponseWriter, r *http.Request, sessionID string) GetSession(tokenOrID string) (*model.Session, error) VerifyEmail(id, email string) error UnverifyEmail(id, email string) error HasAdminPermission(id string) (bool, error) }
func NewUserService ¶
func NewUserService(logger logrus.FieldLogger, store store.Store) UserService