1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-11-24 08:42:17 +02:00

Rename internal/render to internal/response

This commit is contained in:
Kris Runzer 2015-03-28 09:08:05 -07:00
parent db1eb3a9a8
commit 5bdcddd9da
17 changed files with 418 additions and 364 deletions

View File

@ -8,7 +8,7 @@ import (
"golang.org/x/crypto/bcrypt"
"gopkg.in/authboss.v0"
"gopkg.in/authboss.v0/internal/render"
"gopkg.in/authboss.v0/internal/response"
)
const (
@ -24,7 +24,7 @@ func init() {
// Auth module
type Auth struct {
templates render.Templates
templates response.Templates
}
// Initialize module
@ -41,7 +41,7 @@ func (a *Auth) Initialize() (err error) {
return errors.New("auth: XSRFMaker must be defined")
}
a.templates, err = render.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplLogin)
a.templates, err = response.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplLogin)
if err != nil {
return err
}
@ -71,7 +71,7 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
if _, ok := ctx.SessionStorer.Get(authboss.SessionKey); ok {
if halfAuthed, ok := ctx.SessionStorer.Get(authboss.SessionHalfAuthKey); !ok || halfAuthed == "false" {
//http.Redirect(w, r, authboss.Cfg.AuthLoginOKPath, http.StatusFound, true)
render.Redirect(ctx, w, r, authboss.Cfg.AuthLoginOKPath, "", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.AuthLoginOKPath, "", "", true)
return nil
}
}
@ -115,7 +115,7 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
case authboss.InterruptAccountNotConfirmed:
reason = "Your account has not been confirmed."
}
render.Redirect(ctx, w, r, authboss.Cfg.AuthLoginFailPath, "", reason, false)
response.Redirect(ctx, w, r, authboss.Cfg.AuthLoginFailPath, "", reason, false)
return nil
}
@ -125,7 +125,7 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
if err := authboss.Cfg.Callbacks.FireAfter(authboss.EventAuth, ctx); err != nil {
return err
}
render.Redirect(ctx, w, r, authboss.Cfg.AuthLoginOKPath, "", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.AuthLoginOKPath, "", "", true)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
@ -157,7 +157,7 @@ func (a *Auth) logoutHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
ctx.CookieStorer.Del(authboss.CookieRemember)
ctx.SessionStorer.Del(authboss.SessionLastAction)
render.Redirect(ctx, w, r, authboss.Cfg.AuthLogoutOKPath, "", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.AuthLogoutOKPath, "You have logged out", "", true)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}

View File

@ -12,7 +12,7 @@ import (
"path"
"gopkg.in/authboss.v0"
"gopkg.in/authboss.v0/internal/render"
"gopkg.in/authboss.v0/internal/response"
)
// Storer and FormValue constants
@ -46,8 +46,8 @@ func init() {
// Confirm module
type Confirm struct {
emailHTMLTemplates render.Templates
emailTextTemplates render.Templates
emailHTMLTemplates response.Templates
emailTextTemplates response.Templates
}
// Initialize the module
@ -58,11 +58,11 @@ func (c *Confirm) Initialize() (err error) {
return errors.New("confirm: Need a ConfirmStorer")
}
c.emailHTMLTemplates, err = render.LoadTemplates(authboss.Cfg.LayoutHTMLEmail, authboss.Cfg.ViewsPath, tplConfirmHTML)
c.emailHTMLTemplates, err = response.LoadTemplates(authboss.Cfg.LayoutHTMLEmail, authboss.Cfg.ViewsPath, tplConfirmHTML)
if err != nil {
return err
}
c.emailTextTemplates, err = render.LoadTemplates(authboss.Cfg.LayoutTextEmail, authboss.Cfg.ViewsPath, tplConfirmText)
c.emailTextTemplates, err = response.LoadTemplates(authboss.Cfg.LayoutTextEmail, authboss.Cfg.ViewsPath, tplConfirmText)
if err != nil {
return err
}
@ -144,7 +144,7 @@ func (c *Confirm) confirmEmail(to, token string) {
Subject: authboss.Cfg.EmailSubjectPrefix + "Confirm New Account",
}
err := render.RenderEmail(email, c.emailHTMLTemplates, tplConfirmHTML, c.emailTextTemplates, tplConfirmText, url)
err := response.Email(email, c.emailHTMLTemplates, tplConfirmHTML, c.emailTextTemplates, tplConfirmText, url)
if err != nil {
fmt.Fprintf(authboss.Cfg.LogWriter, "confirm: Failed to send e-mail: %v", err)
}
@ -188,7 +188,7 @@ func (c *Confirm) confirmHandler(ctx *authboss.Context, w http.ResponseWriter, r
}
ctx.SessionStorer.Put(authboss.SessionKey, key)
render.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "You have successfully confirmed your account.", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "You have successfully confirmed your account.", "", true)
return nil
}

View File

@ -1,324 +0,0 @@
package render
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"strings"
)
func bindata_read(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
return buf.Bytes(), nil
}
func confirm_email_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb2, 0xc9,
0x30, 0xb4, 0x73, 0xce, 0xcf, 0x4b, 0xcb, 0x2c, 0xca, 0x55, 0xa8, 0xcc,
0x2f, 0x2d, 0x52, 0x48, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xb1, 0xd1,
0x07, 0x4a, 0x70, 0xd9, 0x24, 0x15, 0x29, 0xe8, 0x03, 0xa9, 0x02, 0xbb,
0x80, 0x9c, 0xd4, 0xc4, 0xe2, 0x54, 0x85, 0xe4, 0x9c, 0xcc, 0xe4, 0x6c,
0x05, 0x9b, 0x44, 0x85, 0x8c, 0xa2, 0xd4, 0x34, 0x5b, 0xa5, 0xea, 0x6a,
0xbd, 0xda, 0x5a, 0x25, 0xa0, 0x92, 0x8c, 0xd4, 0xa2, 0x54, 0x1b, 0xfd,
0x44, 0x3b, 0x85, 0x92, 0x7c, 0x85, 0x64, 0xac, 0xc6, 0x15, 0xd8, 0x71,
0x01, 0x02, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xba, 0x4f, 0x59, 0x6c, 0x00,
0x00, 0x00,
},
"confirm_email.html.tpl",
)
}
func confirm_email_txt_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x24, 0xc8,
0xd1, 0x0d, 0x82, 0x40, 0x10, 0x04, 0xd0, 0x56, 0xa6, 0x02, 0x6b, 0xb1,
0x00, 0x7e, 0xce, 0x73, 0xd1, 0x8d, 0xeb, 0x0c, 0xd9, 0x5b, 0x42, 0x08,
0xa1, 0x77, 0x4d, 0xf8, 0x7c, 0xef, 0x1e, 0xd6, 0x86, 0xa1, 0x6b, 0xd9,
0xd1, 0xf8, 0xc4, 0xd2, 0x46, 0x19, 0xea, 0x6d, 0x98, 0x15, 0xa1, 0xcd,
0xf9, 0x42, 0x38, 0x3f, 0x70, 0x96, 0xb0, 0x6b, 0x4d, 0x3c, 0x52, 0xdb,
0xb0, 0xc4, 0xdf, 0x5d, 0x9c, 0x3d, 0xbf, 0xd7, 0xb7, 0xde, 0xb5, 0xb2,
0x26, 0x4e, 0x3c, 0x8e, 0xdb, 0x79, 0xfe, 0x02, 0x00, 0x00, 0xff, 0xff,
0x66, 0x27, 0xac, 0x6d, 0x5b, 0x00, 0x00, 0x00,
},
"confirm_email.txt.tpl",
)
}
func login_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x7c, 0x92,
0xcb, 0x6a, 0xf3, 0x30, 0x10, 0x85, 0xf7, 0x81, 0xbc, 0x83, 0xd0, 0xfe,
0x8f,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, 0xff, 0xa4, 0xb9, 0x16, 0x2d, 0x38, 0xb6,
0x17, 0xf9, 0xb7, 0xfc, 0x29, 0xde, 0xd8, 0xba, 0x06, 0x7f, 0x73, 0xaa,
0x53, 0xa0, 0xe6, 0x69, 0x5c, 0x2c, 0x89, 0x93, 0xba, 0xc3, 0x3d, 0xf8,
0x24, 0x67, 0x8b, 0xd9, 0x06, 0x83, 0xc7, 0x17, 0x70, 0xe0, 0x2a, 0x48,
0x83, 0xbd, 0x0d, 0xd7, 0x06, 0xf4, 0xbe, 0xc2, 0xd3, 0x25, 0x9e, 0xdc,
0x77, 0x26, 0x53, 0x0f, 0xb2, 0x14, 0x97, 0x8d, 0xe2, 0x11, 0x96, 0x97,
0x51, 0xf5, 0xcc, 0xe8, 0xe7, 0x9c, 0xd0, 0x57, 0xce, 0xb2, 0x2c, 0x1f,
0xd2, 0x55, 0xe7, 0xd9, 0xe4, 0x2d, 0xce, 0x74, 0x8b, 0xa2, 0xf1, 0xf0,
0x45, 0xa2, 0x84, 0x21, 0x68, 0x0a, 0x99, 0xd1, 0x24, 0xc9, 0x72, 0xf6,
0xc4, 0x7f, 0xad, 0xd3, 0x0b, 0xca, 0x33, 0x75, 0x7d, 0x02, 0x79, 0x96,
0x06, 0x5b, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x65, 0x0d, 0x58, 0xda,
0x7f, 0x02, 0x00, 0x00,
},
"login.html.tpl",
)
}
func recover_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb4, 0x52,
0x4d, 0x6f, 0xe2, 0x30, 0x10, 0xbd, 0xf3, 0x2b, 0x46, 0x16, 0x7b, 0x25,
0xf7, 0x95, 0x93, 0x0b, 0x7b, 0xd9, 0x4b, 0x8b, 0x5a, 0xd4, 0x6b, 0x65,
0x92, 0x09, 0xb1, 0x6a, 0x8f, 0x2d, 0x67, 0x42, 0x41, 0x6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0x5d, 0x53, 0xea, 0x6f, 0xae, 0xc0, 0x07, 0xa4, 0x98,
0xb8, 0x85, 0xf3, 0x2f, 0xfd, 0xe9, 0xc5, 0x4f, 0xbc, 0xaa, 0x7f, 0xc7,
0xac, 0x4e, 0x37, 0x0d, 0xd2, 0xc5, 0xb1, 0xec, 0xfb, 0xd0, 0x3e, 0xa4,
0xe4, 0x7a, 0xf5, 0x5c, 0x5d, 0xbb, 0x37, 0xa4, 0x69, 0xdd, 0x49, 0x67,
0x33, 0x30, 0x3b, 0x3a, 0x09, 0xf5, 0xc3, 0xc6, 0x6a, 0x16, 0xd5, 0xd3,
0x74, 0xa7, 0xb2, 0x98, 0xba, 0x97, 0xce, 0x48, 0x05, 0x5d, 0xc0, 0xb6,
0x14, 0x85, 0x71, 0x5b, 0x4d, 0xa2, 0x5a, 0x2a, 0xaa, 0xd1, 0xc8, 0x42,
0x55, 0x33, 0x59, 0xe4, 0xe3, 0xaf, 0x3e, 0x03, 0x00, 0x00, 0xff, 0xff,
0xa8, 0x01, 0x1f, 0xc8, 0x03, 0x03, 0x00, 0x00,
},
"recover.html.tpl",
)
}
func recover_complete_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb4, 0x52,
0xc1, 0x6e, 0xeb, 0x20, 0x10, 0xbc, 0xe7, 0x2b, 0x10, 0x7a, 0xe7, 0x70,
0x7f, 0xc2, 0xbe, 0xe4, 0xde, 0x46, 0x6d, 0xee, 0x15, 0x31, 0xeb, 0x18,
0x15, 0x16, 0x04, 0xeb, 0x24, 0x95, 0xe5, 0x7f, 0x2f, 0xc4, 0x49, 0x9c,
0xb6, 0xa9, 0x7a, 0xa8, 0xea, 0x8b, 0x99, 0x65, 0x67, 0x86, 0x91, 0x46,
0xb6, 0x3e, 0x3a, 0xa6, 0x1a, 0x32, 0x1e, 0x2b, 0x3e, 0x0c, 0xce, 0xf7,
0x48, 0x41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 0x73, 0x35, 0xb6, 0x3d, 0x91, 0xc7, 0xb3,
0x50, 0xea, 0xb7, 0xce, 0x10, 0xaf, 0x9f, 0xa6, 0x52, 0x4a, 0x31, 0xdd,
0xde, 0x26, 0x97, 0x8a, 0x75, 0x11, 0xda, 0x8a, 0x0b, 0xeb, 0x77, 0x06,
0x79, 0xbd, 0x52, 0xd8, 0x80, 0x95, 0x42, 0xd5, 0x0b, 0x29, 0x4a, 0xd3,
0xeb, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xba, 0x89, 0x7e, 0x9e, 0xf0,
0x02, 0x00, 0x00,
},
"recover_complete.html.tpl",
)
}
func recover_email_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb2, 0xc9,
0x30, 0xb4, 0x0b, 0x4a, 0x4d, 0xce, 0x2f, 0x4b, 0x2d, 0x52, 0xa8, 0xcc,
0x2f, 0x2d, 0x52, 0x48, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xb1, 0xd1,
0x07, 0x4a, 0x70, 0xd9, 0x24, 0x15, 0x29, 0xe8, 0x03, 0xa9, 0x02, 0xbb,
0x80, 0x9c, 0xd4, 0xc4, 0xe2, 0x54, 0x85, 0xe4, 0x9c, 0xcc, 0xe4, 0x6c,
0x05, 0x9b, 0x44, 0x85, 0x8c, 0xa2, 0xd4, 0x34, 0x5b, 0xa5, 0xea, 0x6a,
0xbd, 0xda, 0x5a, 0x25, 0xa0, 0x92, 0x8c, 0xd4, 0xa2, 0x54, 0x1b, 0xfd,
0x44, 0x3b, 0x85, 0x92, 0x7c, 0x85, 0x22, 0xac, 0xc6, 0x15, 0xd8, 0x71,
0x01, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xc9, 0x73, 0xb1, 0x6c, 0x00,
0x00, 0x00,
},
"recover_email.html.tpl",
)
}
func recover_email_txt_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x24, 0xc8,
0xd1, 0x0d, 0x82, 0x40, 0x10, 0x04, 0xd0, 0x56, 0xa6, 0x02, 0x6b, 0xb1,
0x00, 0x7e, 0xce, 0x73, 0xd1, 0x8d, 0xeb, 0x0c, 0xd9, 0x5b, 0x42, 0x08,
0xa1, 0x77, 0x4d, 0xf8, 0x7c, 0xef, 0x1e, 0xd6, 0x86, 0xa1, 0x6b, 0xd9,
0xd1, 0xf8, 0xc4, 0xd2, 0x46, 0x19, 0xea, 0x6d, 0x98, 0x15, 0xa1, 0xcd,
0xf9, 0x42, 0x38, 0x3f, 0x70, 0x96, 0xb0, 0x6b, 0x4d, 0x3c, 0x52, 0xdb,
0xb0, 0xc4, 0xdf, 0x5d, 0x9c, 0x3d, 0xbf, 0xd7, 0xb7, 0xde, 0xb5, 0xb2,
0x26, 0x4e, 0x3c, 0x8e, 0xdb, 0x79, 0xfe, 0x02, 0x00, 0x00, 0xff, 0xff,
0x66, 0x27, 0xac, 0x6d, 0x5b, 0x00, 0x00, 0x00,
},
"recover_email.txt.tpl",
)
}
func register_html_tpl() ([]byte, error) {
return bindata_read([]byte{
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0x94, 0x53,
0x4d, 0x6f, 0xe2, 0x30, 0x10, 0x3d, 0x93, 0x5f, 0x31, 0xb2, 0x38, 0x93,
0x3b, 0x72, 0x72, 0xd9, 0xbd, 0xec, 0x65, 0x85, 0x56, 0xab, 0x5e, 0x2b,
0x13, 0x4f, 0x88, 0x55, 0x7f, 0xc9, 0x76, 0x0a, 0x28, 0xca, 0x7f, 0xaf,
0x9d, 0x40, 0x42, 0x40, 0x6d, 0xe9, 0xc5, 0xf6, 0x8c, 0xde, 0x9b, 0x79,
0x6f, 0x34, 0xa6, 0xb5, 0x71, 0x0a, 0x58, 0x15, 0x84, 0xd1, 0x05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, 0x6b, 0x7b, 0x69, 0x70, 0xd4, 0xbf, 0xb9,
0x56, 0x78, 0xd6, 0xc0, 0x52, 0x79, 0x65, 0x74, 0x2d, 0x9c, 0x7a, 0x9d,
0x1d, 0xfc, 0x1a, 0x33, 0xf0, 0x9d, 0x93, 0x07, 0xe6, 0xd7, 0x8e, 0xee,
0xcb, 0x3e, 0xe1, 0xec, 0xbe, 0xc3, 0x0f, 0x1c, 0x8e, 0x42, 0x47, 0x41,
0xbe, 0xdd, 0x2b, 0x31, 0x2f, 0xe4, 0xbf, 0xeb, 0xc7, 0x98, 0xda, 0x53,
0x06, 0x8d, 0xc3, 0xba, 0x20, 0x79, 0x74, 0xcf, 0x74, 0x85, 0x92, 0xe6,
0xac, 0xcc, 0xee, 0xca, 0x34, 0x82, 0x73, 0xd4, 0x64, 0xde, 0xfc, 0x93,
0x77, 0xf5, 0xdf, 0x18, 0xa4, 0xe5, 0x9c, 0x96, 0x7d, 0xc8, 0xfe, 0x37,
0x6f, 0xa8, 0xc7, 0x9d, 0xcd, 0x68, 0x9e, 0x7e, 0x69, 0xf9, 0x11, 0x00,
0x00, 0xff, 0xff, 0x0e, 0xa6, 0x2d, 0x81, 0xac, 0x03, 0x00, 0x00,
},
"register.html.tpl",
)
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
return f()
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
"confirm_email.html.tpl": confirm_email_html_tpl,
"confirm_email.txt.tpl": confirm_email_txt_tpl,
"login.html.tpl": login_html_tpl,
"recover.html.tpl": recover_html_tpl,
"recover_complete.html.tpl": recover_complete_html_tpl,
"recover_email.html.tpl": recover_email_html_tpl,
"recover_email.txt.tpl": recover_email_txt_tpl,
"register.html.tpl": register_html_tpl,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() ([]byte, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"confirm_email.html.tpl": &_bintree_t{confirm_email_html_tpl, map[string]*_bintree_t{
}},
"confirm_email.txt.tpl": &_bintree_t{confirm_email_txt_tpl, map[string]*_bintree_t{
}},
"login.html.tpl": &_bintree_t{login_html_tpl, map[string]*_bintree_t{
}},
"recover.html.tpl": &_bintree_t{recover_html_tpl, map[string]*_bintree_t{
}},
"recover_complete.html.tpl": &_bintree_t{recover_complete_html_tpl, map[string]*_bintree_t{
}},
"recover_email.html.tpl": &_bintree_t{recover_email_html_tpl, map[string]*_bintree_t{
}},
"recover_email.txt.tpl": &_bintree_t{recover_email_txt_tpl, map[string]*_bintree_t{
}},
"register.html.tpl": &_bintree_t{register_html_tpl, map[string]*_bintree_t{
}},
}}

View File

@ -0,0 +1,378 @@
package response
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"strings"
"os"
"time"
"io/ioutil"
"path"
"path/filepath"
)
func bindata_read(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
return buf.Bytes(), nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindata_file_info struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindata_file_info) Name() string {
return fi.name
}
func (fi bindata_file_info) Size() int64 {
return fi.size
}
func (fi bindata_file_info) Mode() os.FileMode {
return fi.mode
}
func (fi bindata_file_info) ModTime() time.Time {
return fi.modTime
}
func (fi bindata_file_info) IsDir() bool {
return false
}
func (fi bindata_file_info) Sys() interface{} {
return nil
}
var _confirm_email_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb2\xc9\x30\xb4\x73\xce\xcf\x4b\xcb\x2c\xca\x55\xa8\xcc\x2f\x2d\x52\x48\x4c\x4e\xce\x2f\xcd\x2b\xb1\xd1\x07\x4a\x70\xd9\x24\x15\x29\xe8\x03\xa9\x02\xbb\x80\x9c\xd4\xc4\xe2\x54\x85\xe4\x9c\xcc\xe4\x6c\x05\x9b\x44\x85\x8c\xa2\xd4\x34\x5b\xa5\xea\x6a\xbd\xda\x5a\x25\xa0\x92\x8c\xd4\xa2\x54\x1b\xfd\x44\x3b\x85\x92\x7c\x85\x64\xac\xc6\x15\xd8\x71\x01\x02\x00\x00\xff\xff\xd9\xba\x4f\x59\x6c\x00\x00\x00")
func confirm_email_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_confirm_email_html_tpl,
"confirm_email.html.tpl",
)
}
func confirm_email_html_tpl() (*asset, error) {
bytes, err := confirm_email_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "confirm_email.html.tpl", size: 108, mode: os.FileMode(438), modTime: time.Unix(1425861488, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _confirm_email_txt_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x24\xc8\xd1\x0d\x82\x40\x10\x04\xd0\x56\xa6\x02\x6b\xb1\x00\x7e\xce\x73\xd1\x8d\xeb\x0c\xd9\x5b\x42\x08\xa1\x77\x4d\xf8\x7c\xef\x1e\xd6\x86\xa1\x6b\xd9\xd1\xf8\xc4\xd2\x46\x19\xea\x6d\x98\x15\xa1\xcd\xf9\x42\x38\x3f\x70\x96\xb0\x6b\x4d\x3c\x52\xdb\xb0\xc4\xdf\x5d\x9c\x3d\xbf\xd7\xb7\xde\xb5\xb2\x26\x4e\x3c\x8e\xdb\x79\xfe\x02\x00\x00\xff\xff\x66\x27\xac\x6d\x5b\x00\x00\x00")
func confirm_email_txt_tpl_bytes() ([]byte, error) {
return bindata_read(
_confirm_email_txt_tpl,
"confirm_email.txt.tpl",
)
}
func confirm_email_txt_tpl() (*asset, error) {
bytes, err := confirm_email_txt_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "confirm_email.txt.tpl", size: 91, mode: os.FileMode(438), modTime: time.Unix(1425861619, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _login_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x92\xcb\x6a\xf3\x30\x10\x85\xf7\x81\xbc\x83\xd0\xfe\x8f\x5f\xc0\x36\xfc\xd0\x4d\xa1\x97\xd0\x86\x6e\x8b\x2c\x8f\x2b\x11\x4b\x63\x46\xe3\x5c\x10\x7e\xf7\x5a\xb5\xd3\xc4\xa5\xd4\x2b\xeb\x9c\xd1\x99\x4f\x23\xc5\xb8\x69\x5a\x15\xcc\x7b\xe8\xb5\x86\x10\x86\x61\xbd\xca\x1b\x24\x27\x94\x66\x8b\xbe\x90\x31\x3a\xec\x3d\x77\x8a\x0d\xd4\x42\xb6\xf8\x61\xbd\x1c\x06\x29\x1c\xb0\xc1\xba\x90\xdb\xe7\xd7\x9d\x2c\xd7\x2b\x31\x7e\x31\xda\x46\x6c\x80\x08\x69\x18\xc6\xec\xf9\x2f\xaf\x48\x64\x65\x8c\xe0\xeb\xd4\x20\x55\xe6\xd6\x77\x3d\x0b\x3e\x77\x50\x48\x86\x13\x4b\xa1\x47\x90\x50\xc8\xd4\xfd\x9f\x46\xcf\x84\xad\x14\x5e\x39\x48\x10\x9b\x8e\xac\x53\x74\xbe\xbf\x4b\xbd\xbb\x56\x69\x30\xd8\xd6\x40\xc9\x64\xcb\x2d\x88\x65\xc9\x41\xb5\xfd\x8f\x9d\x6f\x49\x1a\xbd\x72\xe2\x59\x80\xcc\x24\xdd\x88\x70\x44\xaa\xff\xa4\xb9\x16\x2d\x38\xb6\x17\xf9\xb7\xfc\x29\xde\xd8\xba\x06\x7f\x73\xaa\x53\xa0\xe6\x69\x5c\x2c\x89\x93\xba\xc3\x3d\xf8\x24\x67\x8b\xd9\x06\x83\xc7\x17\x70\xe0\x2a\x48\x83\xbd\x0d\xd7\x06\xf4\xbe\xc2\xd3\x25\x9e\xdc\x77\x26\x53\x0f\xb2\x14\x97\x8d\xe2\x11\x96\x97\x51\xf5\xcc\xe8\xe7\x9c\xd0\x57\xce\xb2\x2c\x1f\xd2\x55\xe7\xd9\xe4\x2d\xce\x74\x8b\xa2\xf1\xf0\x45\xa2\x84\x21\x68\x0a\x99\xd1\x24\xc9\x72\xf6\xc4\x7f\xad\xd3\x0b\xca\x33\x75\x7d\x02\x79\x96\x06\x5b\x7e\x06\x00\x00\xff\xff\x65\x0d\x58\xda\x7f\x02\x00\x00")
func login_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_login_html_tpl,
"login.html.tpl",
)
}
func login_html_tpl() (*asset, error) {
bytes, err := login_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "login.html.tpl", size: 639, mode: os.FileMode(438), modTime: time.Unix(1424982621, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _recover_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x52\x4d\x6f\xe2\x30\x10\xbd\xf3\x2b\x46\x16\x7b\x25\xf7\x95\x93\x0b\x7b\xd9\x4b\x8b\x5a\xd4\x6b\x65\x92\x09\xb1\x6a\x8f\x2d\x67\x42\x41\x6e\xfe\x7b\x6d\x82\x10\xb4\x12\xa8\x87\xe6\x90\xcc\xc7\x7b\x6f\x32\x4f\x23\x5b\x17\x2c\xa8\x9a\xb5\xa3\x52\xc4\x68\xdd\x40\xec\x15\x77\xd8\x80\x08\x58\xbb\x1d\x06\x31\x8e\x02\x2c\x72\xe7\x9a\x52\xac\x1e\x9f\xd7\xa2\x9a\x41\x7a\xa4\x26\x3f\x30\xf0\xc1\x63\x29\x18\xf7\x2c\x80\x94\xc5\x2c\xb3\xf0\x41\x5b\x15\x0e\xff\xff\x65\xae\x37\xaa\xc6\xce\x99\x06\x43\x6e\xb2\x66\x83\x70\x0d\xd9\x29\x33\x7c\x61\xbe\xe4\x52\xee\x15\x95\xdc\x84\xf4\x3e\x0e\x8d\x71\xee\x75\x03\x7f\xcb\x2b\x81\x18\xdf\x35\x77\xb0\xc0\x10\xfa\x73\x36\x4f\x99\xd1\x3d\x67\xb0\xa6\x06\xf7\xb0\x80\x4c\xce\x80\xa0\x68\x8b\x67\xc4\x38\xca\xde\x2b\xaa\xd2\xf8\x14\x16\xc7\x78\x9a\x19\x23\xd2\x91\x70\xf9\xb9\xbd\x7d\xed\xa8\xd5\xc1\xbe\xde\x74\x61\x39\x81\xe0\x9e\x1b\x27\xb1\xd5\x5d\x53\xea\x6f\xae\xc0\x07\xa4\x98\xb8\x85\xf3\x2f\xfd\xe9\xc5\x4f\xbc\xaa\x7f\xc7\xac\x4e\x37\x0d\xd2\xc5\xb1\xec\xfb\xd0\x3e\xa4\xe4\x7a\xf5\x5c\x5d\xbb\x37\xa4\x69\xdd\x49\x67\x33\x30\x3b\x3a\x09\xf5\xc3\xc6\x6a\x16\xd5\xd3\x74\xa7\xb2\x98\xba\x97\xce\x48\x05\x5d\xc0\xb6\x14\x85\x71\x5b\x4d\xa2\x5a\x2a\xaa\xd1\xc8\x42\x55\x33\x59\xe4\xe3\xaf\x3e\x03\x00\x00\xff\xff\xa8\x01\x1f\xc8\x03\x03\x00\x00")
func recover_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_recover_html_tpl,
"recover.html.tpl",
)
}
func recover_html_tpl() (*asset, error) {
bytes, err := recover_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "recover.html.tpl", size: 771, mode: os.FileMode(438), modTime: time.Unix(1425014937, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _recover_complete_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x52\xc1\x6e\xeb\x20\x10\xbc\xe7\x2b\x10\x7a\xe7\x70\x7f\xc2\xbe\xe4\xde\x46\x6d\xee\x15\x31\xeb\x18\x15\x16\x04\xeb\x24\x95\xe5\x7f\x2f\xc4\x49\x9c\xb6\xa9\x7a\xa8\xea\x8b\x99\x65\x67\x86\x91\x46\xb6\x3e\x3a\xa6\x1a\x32\x1e\x2b\x3e\x0c\xce\xf7\x48\x41\x51\x07\x9a\xf1\x08\x8d\xdf\x43\x14\x8d\x77\xc1\x02\x01\x1f\x47\xce\x1c\x50\xe7\x75\xc5\xd7\x8f\xcf\x1b\x5e\x2f\x58\xfe\xa4\xc1\xd0\x13\xa3\xb7\x00\x15\xef\x8c\xd6\x80\x9c\xa1\x72\x19\x91\x7f\x2d\x60\xaf\x6c\x0f\x45\x7f\x79\x1a\x14\x1d\x71\x87\x1b\x54\x4a\x07\x1f\xf5\x85\x3d\xe3\x60\x55\x03\x9d\xb7\x1a\x62\xb6\xbe\x8e\x67\xdd\xcb\xea\x24\x2d\xb7\xf1\x62\x30\x0c\x07\x43\x1d\x5b\x42\x8c\x69\x1c\xcf\xe8\x5f\x46\xd6\x24\x62\xff\x2b\x66\x50\xc3\x91\x2d\xd9\xec\x56\xd6\xa2\xc2\x1d\x5c\xf7\xc6\x51\xa6\xa0\xb0\xce\x46\xf9\x28\x4e\xe7\xc9\x63\x18\x00\x75\x21\xdc\xfe\x7e\x4e\xd6\x78\x6c\x4d\x74\x2f\xdf\x24\x5c\x4d\xd7\xec\x5e\xd2\x33\x75\xfd\xfb\xc0\x5f\x1e\xf1\x07\xc1\x3f\xd6\x21\xcb\x1c\x53\x6c\x1f\x32\x28\xef\x9e\x43\x95\xe9\xe6\x73\x35\xb6\x3d\x91\xc7\xb3\x50\xea\xb7\xce\x10\xaf\x9f\xa6\x52\x4a\x31\xdd\xde\x26\x97\x8a\x75\x11\xda\x8a\x0b\xeb\x77\x06\x79\xbd\x52\xd8\x80\x95\x42\xd5\x0b\x29\x4a\xd3\xeb\xf7\x00\x00\x00\xff\xff\xba\x89\x7e\x9e\xf0\x02\x00\x00")
func recover_complete_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_recover_complete_html_tpl,
"recover_complete.html.tpl",
)
}
func recover_complete_html_tpl() (*asset, error) {
bytes, err := recover_complete_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "recover_complete.html.tpl", size: 752, mode: os.FileMode(438), modTime: time.Unix(1425060725, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _recover_email_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb2\xc9\x30\xb4\x0b\x4a\x4d\xce\x2f\x4b\x2d\x52\xa8\xcc\x2f\x2d\x52\x48\x4c\x4e\xce\x2f\xcd\x2b\xb1\xd1\x07\x4a\x70\xd9\x24\x15\x29\xe8\x03\xa9\x02\xbb\x80\x9c\xd4\xc4\xe2\x54\x85\xe4\x9c\xcc\xe4\x6c\x05\x9b\x44\x85\x8c\xa2\xd4\x34\x5b\xa5\xea\x6a\xbd\xda\x5a\x25\xa0\x92\x8c\xd4\xa2\x54\x1b\xfd\x44\x3b\x85\x92\x7c\x85\x22\xac\xc6\x15\xd8\x71\x01\x02\x00\x00\xff\xff\x9d\xc9\x73\xb1\x6c\x00\x00\x00")
func recover_email_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_recover_email_html_tpl,
"recover_email.html.tpl",
)
}
func recover_email_html_tpl() (*asset, error) {
bytes, err := recover_email_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "recover_email.html.tpl", size: 108, mode: os.FileMode(438), modTime: time.Unix(1425861503, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _recover_email_txt_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x24\xc8\xd1\x0d\x82\x40\x10\x04\xd0\x56\xa6\x02\x6b\xb1\x00\x7e\xce\x73\xd1\x8d\xeb\x0c\xd9\x5b\x42\x08\xa1\x77\x4d\xf8\x7c\xef\x1e\xd6\x86\xa1\x6b\xd9\xd1\xf8\xc4\xd2\x46\x19\xea\x6d\x98\x15\xa1\xcd\xf9\x42\x38\x3f\x70\x96\xb0\x6b\x4d\x3c\x52\xdb\xb0\xc4\xdf\x5d\x9c\x3d\xbf\xd7\xb7\xde\xb5\xb2\x26\x4e\x3c\x8e\xdb\x79\xfe\x02\x00\x00\xff\xff\x66\x27\xac\x6d\x5b\x00\x00\x00")
func recover_email_txt_tpl_bytes() ([]byte, error) {
return bindata_read(
_recover_email_txt_tpl,
"recover_email.txt.tpl",
)
}
func recover_email_txt_tpl() (*asset, error) {
bytes, err := recover_email_txt_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "recover_email.txt.tpl", size: 91, mode: os.FileMode(438), modTime: time.Unix(1425861617, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _register_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x94\x53\x4d\x6f\xe2\x30\x10\x3d\x93\x5f\x31\xb2\x38\x93\x3b\x72\x72\xd9\xbd\xec\x65\x85\x56\xab\x5e\x2b\x13\x4f\x88\x55\x7f\xc9\x76\x0a\x28\xca\x7f\xaf\x9d\x40\x42\x40\x6d\xe9\xc5\xf6\x8c\xde\x9b\x79\x6f\x34\xa6\xb5\x71\x0a\x58\x15\x84\xd1\x05\xe9\x3a\x65\x5a\x1d\x2c\x0b\x0d\x72\x20\x0e\x0f\xc2\x07\x74\xa4\xef\x09\x28\x0c\x8d\xe1\x05\xb1\xc6\x07\x52\x66\x2b\x2a\xd9\x1e\x25\x44\x7e\xe2\x6d\xac\x13\x8a\xb9\xf3\x9f\xdf\x11\x5b\x76\x5d\x10\x41\x22\xdc\x66\xb7\x34\x1f\x18\x89\x2a\xb4\x6d\x03\x68\xa6\xf0\x81\x0b\xe1\x6c\x63\x36\xe0\x29\x10\x78\x67\xb2\x1d\x20\x47\x11\x9a\x9b\x6a\x2f\x29\xdf\xf7\x91\x9a\x0e\xd4\x3c\x11\xad\x64\x15\x36\x46\x72\x1c\x14\x3d\x2a\x20\x90\x97\x74\xef\xe2\x99\xad\xba\x6e\x6d\x05\x87\x6d\xb1\x40\x5c\x1b\xa1\x73\x7e\x8a\xd6\x31\x92\x71\x0e\x09\x2c\x34\xc7\x13\x6c\x20\x91\x13\xc0\x31\x7d\xc0\x09\xd1\xf7\xd4\x5b\xa6\xcb\x41\x17\xcd\x87\xf7\xd8\xf0\x22\x72\x79\x2d\x67\x68\x99\xf7\x47\xe3\x38\x29\x77\x97\xd7\x67\x13\x9b\x90\x97\x59\xcd\xf1\x62\x04\xbb\x29\x7d\x6b\x7b\x69\x70\xd4\xbf\xb9\x56\x78\xd6\xc0\x52\x79\x65\x74\x2d\x9c\x7a\x9d\x1d\xfc\x1a\x33\xf0\x9d\x93\x07\xe6\xd7\x8e\xee\xcb\x3e\xe1\xec\xbe\xc3\x0f\x1c\x8e\x42\x47\x41\xbe\xdd\x2b\x31\x2f\xe4\xbf\xeb\xc7\x98\xda\x53\x06\x8d\xc3\xba\x20\x79\x74\xcf\x74\x85\x92\xe6\xac\xcc\xee\xca\x34\x82\x73\xd4\x64\xde\xfc\x93\x77\xf5\xdf\x18\xa4\xe5\x9c\x96\x7d\xc8\xfe\x37\x6f\xa8\xc7\x9d\xcd\x68\x9e\x7e\x69\xf9\x11\x00\x00\xff\xff\x0e\xa6\x2d\x81\xac\x03\x00\x00")
func register_html_tpl_bytes() ([]byte, error) {
return bindata_read(
_register_html_tpl,
"register.html.tpl",
)
}
func register_html_tpl() (*asset, error) {
bytes, err := register_html_tpl_bytes()
if err != nil {
return nil, err
}
info := bindata_file_info{name: "register.html.tpl", size: 940, mode: os.FileMode(438), modTime: time.Unix(1424982621, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"confirm_email.html.tpl": confirm_email_html_tpl,
"confirm_email.txt.tpl": confirm_email_txt_tpl,
"login.html.tpl": login_html_tpl,
"recover.html.tpl": recover_html_tpl,
"recover_complete.html.tpl": recover_complete_html_tpl,
"recover_email.html.tpl": recover_email_html_tpl,
"recover_email.txt.tpl": recover_email_txt_tpl,
"register.html.tpl": register_html_tpl,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for name := range node.Children {
rv = append(rv, name)
}
return rv, nil
}
type _bintree_t struct {
Func func() (*asset, error)
Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"confirm_email.html.tpl": &_bintree_t{confirm_email_html_tpl, map[string]*_bintree_t{
}},
"confirm_email.txt.tpl": &_bintree_t{confirm_email_txt_tpl, map[string]*_bintree_t{
}},
"login.html.tpl": &_bintree_t{login_html_tpl, map[string]*_bintree_t{
}},
"recover.html.tpl": &_bintree_t{recover_html_tpl, map[string]*_bintree_t{
}},
"recover_complete.html.tpl": &_bintree_t{recover_complete_html_tpl, map[string]*_bintree_t{
}},
"recover_email.html.tpl": &_bintree_t{recover_email_html_tpl, map[string]*_bintree_t{
}},
"recover_email.txt.tpl": &_bintree_t{recover_email_txt_tpl, map[string]*_bintree_t{
}},
"register.html.tpl": &_bintree_t{register_html_tpl, map[string]*_bintree_t{
}},
}}
// Restore an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, path.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// Restore assets under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
if err != nil { // File
return RestoreAsset(dir, name)
} else { // Dir
for _, child := range children {
err = RestoreAssets(dir, path.Join(name, child))
if err != nil {
return err
}
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

View File

@ -1,7 +1,7 @@
// Package render is responsible for loading and rendering authboss templates.
package render
// Package response is responsible for loading and rendering authboss templates.
package response
//go:generate go-bindata -pkg=render -prefix=templates templates
//go:generate go-bindata -pkg=response -prefix=templates templates
import (
"bytes"
@ -107,7 +107,7 @@ func (t Templates) Render(ctx *authboss.Context, w http.ResponseWriter, r *http.
}
// RenderEmail renders the html and plaintext views for an email and sends it
func RenderEmail(email authboss.Email, htmlTpls Templates, nameHTML string, textTpls Templates, namePlain string, data interface{}) error {
func Email(email authboss.Email, htmlTpls Templates, nameHTML string, textTpls Templates, namePlain string, data interface{}) error {
tplHTML, ok := htmlTpls[nameHTML]
if !ok {
return authboss.RenderErr{tplHTML.Name(), data, ErrTemplateNotFound}

View File

@ -1,4 +1,4 @@
package render
package response
import (
"html/template"
@ -84,7 +84,7 @@ func TestTemplates_Render(t *testing.T) {
}
}
func TestTemplates_RenderEmail(t *testing.T) {
func Test_Email(t *testing.T) {
mockMailer := &mocks.MockMailer{}
authboss.Cfg.Mailer = mockMailer
@ -95,7 +95,7 @@ func TestTemplates_RenderEmail(t *testing.T) {
To: []string{"a@b.c"},
}
err := RenderEmail(email, htmlTpls, "html", textTpls, "plain", "spoon")
err := Email(email, htmlTpls, "html", textTpls, "plain", "spoon")
if err != nil {
t.Error(err)
}
@ -142,7 +142,7 @@ func TestRedirect(t *testing.T) {
}
}
func TestRedirect_Ovveride(t *testing.T) {
func TestRedirect_Override(t *testing.T) {
cookies := mocks.NewMockClientStorer()
r, _ := http.NewRequest("GET", "http://localhost?redir=foo/bar", nil)

View File

@ -14,7 +14,7 @@ import (
"golang.org/x/oauth2"
"gopkg.in/authboss.v0"
"gopkg.in/authboss.v0/internal/render"
"gopkg.in/authboss.v0/internal/response"
)
var (
@ -220,7 +220,7 @@ func oauthCallback(ctx *authboss.Context, w http.ResponseWriter, r *http.Request
}
sf := fmt.Sprintf("Logged in successfully with %s.", strings.Title(provider))
render.Redirect(ctx, w, r, redirect, sf, "", false)
response.Redirect(ctx, w, r, redirect, sf, "", false)
return nil
}
@ -231,7 +231,7 @@ func logout(ctx *authboss.Context, w http.ResponseWriter, r *http.Request) error
ctx.CookieStorer.Del(authboss.CookieRemember)
ctx.SessionStorer.Del(authboss.SessionLastAction)
render.Redirect(ctx, w, r, authboss.Cfg.AuthLogoutOKPath, "You have logged out", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.AuthLogoutOKPath, "You have logged out", "", true)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}

View File

@ -13,7 +13,7 @@ import (
"golang.org/x/crypto/bcrypt"
"gopkg.in/authboss.v0"
"gopkg.in/authboss.v0/internal/render"
"gopkg.in/authboss.v0/internal/response"
)
// Storage constants
@ -56,9 +56,9 @@ func init() {
// Recover module
type Recover struct {
templates render.Templates
emailHTMLTemplates render.Templates
emailTextTemplates render.Templates
templates response.Templates
emailHTMLTemplates response.Templates
emailTextTemplates response.Templates
}
// Initialize module
@ -79,16 +79,16 @@ func (r *Recover) Initialize() (err error) {
return errors.New("auth: XSRFMaker must be defined")
}
r.templates, err = render.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplRecover, tplRecoverComplete)
r.templates, err = response.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplRecover, tplRecoverComplete)
if err != nil {
return err
}
r.emailHTMLTemplates, err = render.LoadTemplates(authboss.Cfg.LayoutHTMLEmail, authboss.Cfg.ViewsPath, tplInitHTMLEmail)
r.emailHTMLTemplates, err = response.LoadTemplates(authboss.Cfg.LayoutHTMLEmail, authboss.Cfg.ViewsPath, tplInitHTMLEmail)
if err != nil {
return err
}
r.emailTextTemplates, err = render.LoadTemplates(authboss.Cfg.LayoutTextEmail, authboss.Cfg.ViewsPath, tplInitTextEmail)
r.emailTextTemplates, err = response.LoadTemplates(authboss.Cfg.LayoutTextEmail, authboss.Cfg.ViewsPath, tplInitTextEmail)
if err != nil {
return err
}
@ -168,7 +168,7 @@ func (rec *Recover) startHandlerFunc(ctx *authboss.Context, w http.ResponseWrite
goRecoverEmail(rec, email, encodedToken)
ctx.SessionStorer.Put(authboss.FlashSuccessKey, recoverInitiateSuccessFlash)
render.Redirect(ctx, w, r, authboss.Cfg.RecoverOKPath, "", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.RecoverOKPath, "", "", true)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}
@ -200,7 +200,7 @@ func (r *Recover) sendRecoverEmail(to, encodedToken string) {
Subject: authboss.Cfg.EmailSubjectPrefix + "Password Reset",
}
if err := render.RenderEmail(email, r.emailHTMLTemplates, tplInitHTMLEmail, r.emailTextTemplates, tplInitTextEmail, url); err != nil {
if err := response.Email(email, r.emailHTMLTemplates, tplInitHTMLEmail, r.emailTextTemplates, tplInitTextEmail, url); err != nil {
fmt.Fprintln(authboss.Cfg.LogWriter, "recover: failed to send recover email:", err)
}
}
@ -266,7 +266,7 @@ func (r *Recover) completeHandlerFunc(ctx *authboss.Context, w http.ResponseWrit
}
ctx.SessionStorer.Put(authboss.SessionKey, primaryID)
render.Redirect(ctx, w, req, authboss.Cfg.AuthLoginOKPath, "", "", true)
response.Redirect(ctx, w, req, authboss.Cfg.AuthLoginOKPath, "", "", true)
default:
w.WriteHeader(http.StatusMethodNotAllowed)
}

View File

@ -7,7 +7,7 @@ import (
"golang.org/x/crypto/bcrypt"
"gopkg.in/authboss.v0"
"gopkg.in/authboss.v0/internal/render"
"gopkg.in/authboss.v0/internal/response"
)
const (
@ -28,7 +28,7 @@ func init() {
// Register module.
type Register struct {
templates render.Templates
templates response.Templates
}
// Initialize the module.
@ -41,7 +41,7 @@ func (r *Register) Initialize() (err error) {
return errors.New("register: RegisterStorer required for register functionality")
}
if r.templates, err = render.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplRegister); err != nil {
if r.templates, err = response.LoadTemplates(authboss.Cfg.Layout, authboss.Cfg.ViewsPath, tplRegister); err != nil {
return err
}
@ -117,12 +117,12 @@ func (reg *Register) registerPostHandler(ctx *authboss.Context, w http.ResponseW
}
if authboss.IsLoaded("confirm") {
render.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, please verify your e-mail address.", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, please verify your e-mail address.", "", true)
return nil
}
ctx.SessionStorer.Put(authboss.SessionKey, key)
render.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, you are now logged in.", "", true)
response.Redirect(ctx, w, r, authboss.Cfg.RegisterOKPath, "Account successfully created, you are now logged in.", "", true)
return nil
}