2012-12-11 05:59:23 +04:00
package main
import (
"html/template"
"log"
)
func getTemplates ( ) * template . Template {
t , err := template . New ( "foo" ) . Parse ( ` { { define "sign_in.html" } }
2012-12-26 19:55:41 +04:00
< ! DOCTYPE html >
< html lang = "en" charset = "utf-8" >
< head > < title > Sign In < / title > < / head >
< body >
2012-12-11 05:59:23 +04:00
< form method = "GET" action = "/oauth2/start" >
2013-10-22 23:56:29 +04:00
< input type = "hidden" name = "rd" value = "{{.Redirect}}" >
2012-12-11 05:59:23 +04:00
< button type = "submit" > Sign In w / Google < / button >
{ { . SignInMessage } }
< / form >
2012-12-26 19:55:41 +04:00
{ { if . Htpasswd } }
< fieldset >
< form method = "POST" action = "/oauth2/sign_in" >
2013-10-22 23:56:29 +04:00
< input type = "hidden" name = "rd" value = "{{.Redirect}}" >
2012-12-26 19:55:41 +04:00
< label > Username : < input type = "text" name = "username" size = "10" > < / label > < br / >
< label > Password : < input type = "password" name = "password" size = "10" > < / label > < br / >
< button type = "submit" > Sign In < / button >
< / form >
< / fieldset >
{ { end } }
< / body >
< / html >
2012-12-11 05:59:23 +04:00
{ { end } } ` )
if err != nil {
log . Fatalf ( "failed parsing template %s" , err . Error ( ) )
}
2012-12-17 22:38:33 +04:00
2012-12-11 05:59:23 +04:00
t , err = t . Parse ( ` { { define "error.html" } }
2012-12-26 19:55:41 +04:00
< ! DOCTYPE html >
< html lang = "en" charset = "utf-8" >
< head > < title > { { . Title } } < / title > < / head >
2012-12-11 05:59:23 +04:00
< body >
< h2 > { { . Title } } < / h2 >
< p > { { . Message } } < / p >
< hr >
2012-12-17 22:15:23 +04:00
< p > < a href = "/oauth2/sign_in" > Sign In < / a > < / p >
2012-12-11 05:59:23 +04:00
< / body >
< / html > { { end } } ` )
if err != nil {
log . Fatalf ( "failed parsing template %s" , err . Error ( ) )
}
return t
}