mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-09-29 15:01:59 +00:00
added a login screen
This commit is contained in:
parent
3fe374559a
commit
54ccb62f00
3 changed files with 81 additions and 0 deletions
|
@ -61,6 +61,10 @@ func (s *SiteHandler) GetUser(w http.ResponseWriter, r *http.Request) error {
|
||||||
return s.render(w, "user_conf.html", struct{ User *user.User }{u})
|
return s.render(w, "user_conf.html", struct{ User *user.User }{u})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SiteHandler) GetLogin(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
return s.render(w, "login.html", struct{ User *user.User }{nil})
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SiteHandler) GetUsers(w http.ResponseWriter, r *http.Request) error {
|
func (s *SiteHandler) GetUsers(w http.ResponseWriter, r *http.Request) error {
|
||||||
u := s.sess.User(r)
|
u := s.sess.User(r)
|
||||||
if u == nil || u.Admin == false {
|
if u == nil || u.Admin == false {
|
||||||
|
@ -176,6 +180,7 @@ func (s *SiteHandler) Register(r *pat.Router) {
|
||||||
r.Get("/admin/settings", errorHandler(s.GetConfig))
|
r.Get("/admin/settings", errorHandler(s.GetConfig))
|
||||||
r.Get("/account/profile", errorHandler(s.GetUser))
|
r.Get("/account/profile", errorHandler(s.GetUser))
|
||||||
r.Get("/account/repos", errorHandler(s.GetRepos))
|
r.Get("/account/repos", errorHandler(s.GetRepos))
|
||||||
|
r.Get("/login", errorHandler(s.GetLogin))
|
||||||
r.Get("/{host}/{owner}/{name}/settings", errorHandler(s.GetRepoAdmin))
|
r.Get("/{host}/{owner}/{name}/settings", errorHandler(s.GetRepoAdmin))
|
||||||
r.Get("/{host}/{owner}/{name}/branch/{branch}/commit/{commit}", errorHandler(s.GetRepo))
|
r.Get("/{host}/{owner}/{name}/branch/{branch}/commit/{commit}", errorHandler(s.GetRepo))
|
||||||
r.Get("/{host}/{owner}/{name}/branch/{branch}", errorHandler(s.GetRepo))
|
r.Get("/{host}/{owner}/{name}/branch/{branch}", errorHandler(s.GetRepo))
|
||||||
|
|
55
server/template/html/login.html
Normal file
55
server/template/html/login.html
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="{{"utf-8"}}" />
|
||||||
|
<meta name="{{"author"}}" content="{{"Brad Rydzewski"}}" />
|
||||||
|
<link rel="{{"shortcut icon"}}" href="{{"/static/images/favicon.png"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"//yui.yahooapis.com/pure/0.4.2/pure-min.css"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"//fonts.googleapis.com/css?family=Open+Sans"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"//fonts.googleapis.com/css?family=Orbitron"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"//fonts.googleapis.com/css?family=Droid+Sans+Mono"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"}}" />
|
||||||
|
<link rel="{{"stylesheet"}}" href="{{"/static/styles/drone.css"}}" />
|
||||||
|
<title>Login
|
||||||
|
</title>{{$link := ""}}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<a class="{{"header-brand"}}" href="{{"/"}}">Drone</a>{{if .User}}
|
||||||
|
<a href="{{"/account/profile"}}" class="{{"header-user"}}">{{$__amber_1 := .User.Gravatar}}{{$__amber_2 := __amber_add "//secure.gravatar.com/avatar/" $__amber_1}}{{$__amber_3 := __amber_add $__amber_2 "?s=64"}}
|
||||||
|
<img class="{{"header-avatar"}}" src="{{$__amber_3}}" />
|
||||||
|
<span class="{{"header-username"}}">{{$__amber_4 := .User.Login}}{{$__amber_4}}</span>
|
||||||
|
</a>{{else}}
|
||||||
|
<span>Login</span>{{end}}
|
||||||
|
</header>
|
||||||
|
<div>
|
||||||
|
<article>
|
||||||
|
<header>
|
||||||
|
<h1>Login</h1>
|
||||||
|
</header>
|
||||||
|
<section>
|
||||||
|
<section class="{{"pure-g"}}">
|
||||||
|
<div class="{{"pure-u-1"}}">
|
||||||
|
<a href="{{"/login/github.com"}}">GitHub</a>
|
||||||
|
</div>
|
||||||
|
<div class="{{"pure-u-1"}}">
|
||||||
|
<a href="{{"/login/enterprise.github.com"}}">GitHub Enterprise</a>
|
||||||
|
</div>
|
||||||
|
<div class="{{"pure-u-1"}}">
|
||||||
|
<a href="{{"/login/bitbucket.org"}}">Bitbucket</a>
|
||||||
|
</div>
|
||||||
|
<div class="{{"pure-u-1"}}">
|
||||||
|
<a href="{{"/login/stash.atlassian.com"}}">Stash</a>
|
||||||
|
</div>
|
||||||
|
<div class="{{"pure-u-1"}}">
|
||||||
|
<a href="{{"/login/gitlab.com"}}">GitLab</a>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
<script src="{{"//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"}}"></script>
|
||||||
|
<script src="{{"//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.1.0/jquery.timeago.js"}}"></script>
|
||||||
|
<script src="{{"/static/scripts/main.js"}}"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
21
server/template/login.amber
Normal file
21
server/template/login.amber
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
extends base
|
||||||
|
|
||||||
|
block title
|
||||||
|
| Login
|
||||||
|
|
||||||
|
block content
|
||||||
|
article
|
||||||
|
header
|
||||||
|
h1 Login
|
||||||
|
section
|
||||||
|
section.pure-g
|
||||||
|
div.pure-u-1
|
||||||
|
a[href="/login/github.com"] GitHub
|
||||||
|
div.pure-u-1
|
||||||
|
a[href="/login/enterprise.github.com"] GitHub Enterprise
|
||||||
|
div.pure-u-1
|
||||||
|
a[href="/login/bitbucket.org"] Bitbucket
|
||||||
|
div.pure-u-1
|
||||||
|
a[href="/login/stash.atlassian.com"] Stash
|
||||||
|
div.pure-u-1
|
||||||
|
a[href="/login/gitlab.com"] GitLab
|
Loading…
Reference in a new issue