1
0
mirror of https://github.com/volatiletech/authboss.git synced 2025-01-06 03:54:17 +02:00

Add 'showRegister' flag to auth module.

This commit is contained in:
Kris Runzer 2015-04-10 12:04:26 -07:00
parent 52c2f83e17
commit 24b9501709
3 changed files with 6 additions and 4 deletions

View File

@ -73,7 +73,6 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
case methodGET:
if _, ok := ctx.SessionStorer.Get(authboss.SessionKey); ok {
if halfAuthed, ok := ctx.SessionStorer.Get(authboss.SessionHalfAuthKey); !ok || halfAuthed == "false" {
//http.Redirect(w, r, a.AuthLoginOKPath, http.StatusFound, true)
response.Redirect(ctx, w, r, a.AuthLoginOKPath, "", "", true)
return nil
}
@ -82,6 +81,7 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
data := authboss.NewHTMLData(
"showRemember", a.IsLoaded("remember"),
"showRecover", a.IsLoaded("recover"),
"showRegister", a.IsLoaded("register"),
"primaryID", a.PrimaryID,
"primaryIDValue", "",
)
@ -96,6 +96,7 @@ func (a *Auth) loginHandlerFunc(ctx *authboss.Context, w http.ResponseWriter, r
"primaryIDValue", key,
"showRemember", a.IsLoaded("remember"),
"showRecover", a.IsLoaded("recover"),
"showRegister", a.IsLoaded("register"),
)
policies := authboss.FilterValidators(a.Policies, a.PrimaryID, authboss.StorePassword)

View File

@ -101,7 +101,7 @@ func confirm_email_txt_tpl() (*asset, error) {
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")
var _login_html_tpl = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x7c\x92\xcb\x6e\xeb\x20\x10\x86\xf7\x91\xf2\x0e\x88\xfd\x89\x5f\xc0\xb6\x74\xa4\xb3\x39\x52\x2f\x51\x1b\x75\x5b\x61\x3c\x0e\x28\x06\xac\x61\x9c\x8b\x90\xdf\xbd\xa6\x76\x5a\xd3\x46\xf1\xca\x0c\x3f\x1f\x1f\x30\x21\x6c\x9a\x56\x78\xf5\xee\x7b\x29\xc1\xfb\x61\x58\xaf\xf2\xc6\xa1\x61\x42\x92\x76\xb6\xe0\x21\x18\xd7\x5b\xea\x04\x29\xa8\x19\x6f\xdd\x5e\x5b\x3e\x0c\x9c\x19\x20\xe5\xea\x82\x6f\x9f\x5f\x77\xbc\x5c\xaf\xd8\xf8\x85\xa0\x1b\xb6\x01\x44\x87\xc3\x30\xb2\xe7\xbf\xbc\x42\x96\x95\x21\x80\xad\xe3\x06\x31\x99\x6b\xdb\xf5\xc4\xe8\xd2\x41\xc1\x09\xce\xc4\x99\x1c\x45\x7c\xc1\xe3\xee\x7f\xa4\xb3\x84\xae\xe5\xcc\x0a\x03\x51\x62\xd3\xa1\x36\x02\x2f\xff\xff\xc5\xbd\xbb\x56\x48\x50\xae\xad\x01\xe3\x24\x69\x6a\x81\xa5\x91\xa3\x68\xfb\x1f\x2b\xdf\x62\x69\x9c\x2b\x27\x9f\x44\x64\x36\xe9\x46\x85\x93\xc3\xfa\xae\xcd\x77\x28\xf1\xd8\x5e\xcb\xb7\xf8\x13\x5e\xe9\xba\x06\xbb\x38\xd5\xd9\x63\xf3\x34\x0e\x52\xe3\x58\xdd\xb9\x03\xd8\x58\xce\x92\xbb\xf5\xca\x9d\x5e\xc0\x80\xa9\x20\x5e\xec\x12\x2e\x15\xc8\x43\xe5\xce\x57\x3c\x9a\x2f\x26\x61\x0f\xbc\x64\xd7\x85\xec\x11\xd2\xc7\xa8\x7a\x22\x67\x67\x8e\xef\x2b\xa3\x89\x97\x0f\xf1\xa9\xf3\x6c\x9a\x4b\xce\xb4\x54\x91\xee\xf8\x69\x22\x98\x42\x68\x7e\xf5\x0b\x4e\x81\xd8\x31\xe5\x1c\x66\x7f\xa5\x8c\x91\x3c\x13\x69\x4f\x2c\xb1\x7b\xed\xe9\x3e\x77\x4a\xcc\xe0\x69\x70\x93\x9c\x67\xf1\x0d\xcb\x8f\x00\x00\x00\xff\xff\x66\x78\xba\x32\xea\x02\x00\x00")
func login_html_tpl_bytes() ([]byte, error) {
return bindata_read(
@ -116,7 +116,7 @@ func login_html_tpl() (*asset, error) {
return nil, err
}
info := bindata_file_info{name: "login.html.tpl", size: 639, mode: os.FileMode(438), modTime: time.Unix(1424982621, 0)}
info := bindata_file_info{name: "login.html.tpl", size: 746, mode: os.FileMode(438), modTime: time.Unix(1428692472, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}

View File

@ -6,5 +6,6 @@
<input type="hidden" name="{{.xsrfName}}" value="{{.xsrfToken}}" />
{{if .showRemember}}<input type="checkbox" name="rm" value="true"> Remember Me{{end}}
<button type="submit">Login</button><br />
{{if .showRecover}}<a href="/recover">Recover Account</a>{{end}}
{{if .showRecover}}<a href="{{mountpathed "recover"}}">Recover Account</a>{{end}}
{{if .showRegister}}<a href="{{mountpathed "register"}}">Register Account</a>{{end}}
</form>