diff options
author | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-04-06 23:48:49 -0400 |
commit | ac43eab51f9ac0d4c4bcc6db2bbc9ce3dbb34b7b (patch) | |
tree | 4e5fd54b821ef1af312e4d1f1c1a9befad7054a7 | |
parent | 8d0417497b39aa196400d39c99bbd79cfb364f9f (diff) |
Refactoring: rename Signed -> Logged
37 files changed, 106 insertions, 104 deletions
diff --git a/pkg/context/auth.go b/pkg/context/auth.go index d2bfe603..9ad5cdd0 100644 --- a/pkg/context/auth.go +++ b/pkg/context/auth.go @@ -30,20 +30,20 @@ func Toggle(options *ToggleOptions) macaron.Handler { } // Check prohibit login users. - if ctx.IsSigned && ctx.User.ProhibitLogin { + if ctx.IsLogged && ctx.User.ProhibitLogin { ctx.Data["Title"] = ctx.Tr("auth.prohibit_login") ctx.HTML(200, "user/auth/prohibit_login") return } // Check non-logged users landing page. - if !ctx.IsSigned && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME { + if !ctx.IsLogged && ctx.Req.RequestURI == "/" && setting.LandingPageURL != setting.LANDING_PAGE_HOME { ctx.Redirect(setting.AppSubURL + string(setting.LandingPageURL)) return } // Redirect to dashboard if user tries to visit any non-login page. - if options.SignOutRequired && ctx.IsSigned && ctx.Req.RequestURI != "/" { + if options.SignOutRequired && ctx.IsLogged && ctx.Req.RequestURI != "/" { ctx.Redirect(setting.AppSubURL + "/") return } @@ -56,7 +56,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { } if options.SignInRequired { - if !ctx.IsSigned { + if !ctx.IsLogged { // Restrict API calls with error message. if auth.IsAPIPath(ctx.Req.URL.Path) { ctx.JSON(403, map[string]string{ @@ -76,7 +76,7 @@ func Toggle(options *ToggleOptions) macaron.Handler { } // Redirect to log in page if auto-signin info is provided and has not signed in. - if !options.SignOutRequired && !ctx.IsSigned && !auth.IsAPIPath(ctx.Req.URL.Path) && + if !options.SignOutRequired && !ctx.IsLogged && !auth.IsAPIPath(ctx.Req.URL.Path) && len(ctx.GetCookie(setting.CookieUserName)) > 0 { ctx.SetCookie("redirect_to", url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL) ctx.Redirect(setting.AppSubURL + "/user/login") diff --git a/pkg/context/context.go b/pkg/context/context.go index 1649dc3d..fa4ed16e 100644 --- a/pkg/context/context.go +++ b/pkg/context/context.go @@ -34,18 +34,20 @@ type Context struct { Session session.Store User *models.User - IsSigned bool + IsLogged bool IsBasicAuth bool Repo *Repository Org *Organization } -func (ctx *Context) UserID() int64 { - if !ctx.IsSigned { +// UserID returns ID of current logged in user. +// It returns 0 if visitor is anonymous. +func (c *Context) UserID() int64 { + if !c.IsLogged { return 0 } - return ctx.User.ID + return c.User.ID } // HasError returns true if error occurs in form validation. @@ -112,7 +114,7 @@ func (ctx *Context) Handle(status int, title string, err error) { case http.StatusInternalServerError: ctx.Data["Title"] = "Internal Server Error" log.Error(2, "%s: %v", title, err) - if !setting.ProdMode || (ctx.IsSigned && ctx.User.IsAdmin) { + if !setting.ProdMode || (ctx.IsLogged && ctx.User.IsAdmin) { ctx.Data["ErrorMsg"] = err } } @@ -193,15 +195,15 @@ func Contexter() macaron.Handler { ctx.User, ctx.IsBasicAuth = auth.SignedInUser(ctx.Context, ctx.Session) if ctx.User != nil { - ctx.IsSigned = true - ctx.Data["IsSigned"] = ctx.IsSigned - ctx.Data["SignedUser"] = ctx.User - ctx.Data["SignedUserID"] = ctx.User.ID - ctx.Data["SignedUserName"] = ctx.User.Name + ctx.IsLogged = true + ctx.Data["IsLogged"] = ctx.IsLogged + ctx.Data["LoggedUser"] = ctx.User + ctx.Data["LoggedUserID"] = ctx.User.ID + ctx.Data["LoggedUserName"] = ctx.User.Name ctx.Data["IsAdmin"] = ctx.User.IsAdmin } else { - ctx.Data["SignedUserID"] = 0 - ctx.Data["SignedUserName"] = "" + ctx.Data["LoggedUserID"] = 0 + ctx.Data["LoggedUserName"] = "" } // If request sends files, parse them here otherwise the Query() can't be parsed and the CsrfToken will be invalid. diff --git a/pkg/context/org.go b/pkg/context/org.go index 49785674..be0b0572 100644 --- a/pkg/context/org.go +++ b/pkg/context/org.go @@ -63,12 +63,12 @@ func HandleOrgAssignment(ctx *Context, args ...bool) { } // Admin has super access. - if ctx.IsSigned && ctx.User.IsAdmin { + if ctx.IsLogged && ctx.User.IsAdmin { ctx.Org.IsOwner = true ctx.Org.IsMember = true ctx.Org.IsTeamMember = true ctx.Org.IsTeamAdmin = true - } else if ctx.IsSigned { + } else if ctx.IsLogged { ctx.Org.IsOwner = org.IsOwnedBy(ctx.User.ID) if ctx.Org.IsOwner { ctx.Org.IsMember = true diff --git a/pkg/context/repo.go b/pkg/context/repo.go index a1924954..ecaf7ff6 100644 --- a/pkg/context/repo.go +++ b/pkg/context/repo.go @@ -151,7 +151,7 @@ func RepoAssignment(pages ...bool) macaron.Handler { } // Check if the user is the same as the repository owner - if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(ownerName) { + if ctx.IsLogged && ctx.User.LowerName == strings.ToLower(ownerName) { owner = ctx.User } else { owner, err = models.GetUserByName(ownerName) @@ -194,7 +194,7 @@ func RepoAssignment(pages ...bool) macaron.Handler { ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name // Admin has super access. - if ctx.IsSigned && ctx.User.IsAdmin { + if ctx.IsLogged && ctx.User.IsAdmin { ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER } else { mode, err := models.AccessLevel(ctx.UserID(), repo) @@ -278,7 +278,7 @@ func RepoAssignment(pages ...bool) macaron.Handler { ctx.Data["CloneLink"] = repo.CloneLink() ctx.Data["WikiCloneLink"] = repo.WikiCloneLink() - if ctx.IsSigned { + if ctx.IsLogged { ctx.Data["IsWatchingRepo"] = models.IsWatching(ctx.User.ID, repo.ID) ctx.Data["IsStaringRepo"] = models.IsStaring(ctx.User.ID, repo.ID) } @@ -424,7 +424,7 @@ func RepoRef() macaron.Handler { ctx.Data["IsViewCommit"] = ctx.Repo.IsViewCommit // People who have push access or have fored repository can propose a new pull request. - if ctx.Repo.IsWriter() || (ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) { + if ctx.Repo.IsWriter() || (ctx.IsLogged && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID)) { // Pull request is allowed if this is a fork repository // and base repository accepts pull requests. if ctx.Repo.Repository.BaseRepo != nil { @@ -459,7 +459,7 @@ func RepoRef() macaron.Handler { func RequireRepoAdmin() macaron.Handler { return func(ctx *Context) { - if !ctx.IsSigned || (!ctx.Repo.IsAdmin() && !ctx.User.IsAdmin) { + if !ctx.IsLogged || (!ctx.Repo.IsAdmin() && !ctx.User.IsAdmin) { ctx.NotFound() return } @@ -468,7 +468,7 @@ func RequireRepoAdmin() macaron.Handler { func RequireRepoWriter() macaron.Handler { return func(ctx *Context) { - if !ctx.IsSigned || (!ctx.Repo.IsWriter() && !ctx.User.IsAdmin) { + if !ctx.IsLogged || (!ctx.Repo.IsWriter() && !ctx.User.IsAdmin) { ctx.NotFound() return } diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index d4aa8aee..b54e47b7 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -34,7 +34,7 @@ func repoAssignment() macaron.Handler { ) // Check if the user is the same as the repository owner. - if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) { + if ctx.IsLogged && ctx.User.LowerName == strings.ToLower(userName) { owner = ctx.User } else { owner, err = models.GetUserByName(userName) @@ -63,7 +63,7 @@ func repoAssignment() macaron.Handler { return } - if ctx.IsSigned && ctx.User.IsAdmin { + if ctx.IsLogged && ctx.User.IsAdmin { ctx.Repo.AccessMode = models.ACCESS_MODE_OWNER } else { mode, err := models.AccessLevel(ctx.User.ID, repo) @@ -86,7 +86,7 @@ func repoAssignment() macaron.Handler { // Contexter middleware already checks token for user sign in process. func reqToken() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned { + if !ctx.IsLogged { ctx.Error(401) return } @@ -104,7 +104,7 @@ func reqBasicAuth() macaron.Handler { func reqAdmin() macaron.Handler { return func(ctx *context.Context) { - if !ctx.IsSigned || !ctx.User.IsAdmin { + if !ctx.IsLogged || !ctx.User.IsAdmin { ctx.Error(403) return } diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index e095954a..fdb3e7a5 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -28,7 +28,7 @@ func Search(ctx *context.APIContext) { } // Check visibility. - if ctx.IsSigned && opts.OwnerID > 0 { + if ctx.IsLogged && opts.OwnerID > 0 { if ctx.User.ID == opts.OwnerID { opts.Private = true } else { diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index d797c650..11c3b8bb 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -41,7 +41,7 @@ func Search(ctx *context.APIContext) { AvatarUrl: users[i].AvatarLink(), FullName: users[i].FullName, } - if ctx.IsSigned { + if ctx.IsLogged { results[i].Email = users[i].Email } } @@ -64,7 +64,7 @@ func GetInfo(ctx *context.APIContext) { } // Hide user e-mail when API caller isn't signed in. - if !ctx.IsSigned { + if !ctx.IsLogged { u.Email = "" } ctx.JSON(200, u.APIFormat()) diff --git a/routers/home.go b/routers/home.go index eaf33815..7d9ee27b 100644 --- a/routers/home.go +++ b/routers/home.go @@ -21,7 +21,7 @@ const ( ) func Home(ctx *context.Context) { - if ctx.IsSigned { + if ctx.IsLogged { if !ctx.User.IsActive && setting.Service.RegisterEmailConfirm { ctx.Data["Title"] = ctx.Tr("auth.active_your_account") ctx.HTML(200, user.ACTIVATE) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 61401b43..72b1a388 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -70,7 +70,7 @@ func MustAllowPulls(ctx *context.Context) { } // User can send pull request if owns a forked repository. - if ctx.IsSigned && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) { + if ctx.IsLogged && ctx.User.HasForkedRepo(ctx.Repo.Repository.ID) { ctx.Repo.PullRequest.Allowed = true ctx.Repo.PullRequest.HeadInfo = ctx.User.Name + ":" + ctx.Repo.BranchName } @@ -115,7 +115,7 @@ func issues(ctx *context.Context, isPullList bool) { } // Must sign in to see issues about you. - if viewType != "all" && !ctx.IsSigned { + if viewType != "all" && !ctx.IsLogged { ctx.SetCookie("redirect_to", "/"+url.QueryEscape(setting.AppSubURL+ctx.Req.RequestURI), 0, setting.AppSubURL) ctx.Redirect(setting.AppSubURL + "/user/login") return @@ -138,7 +138,7 @@ func issues(ctx *context.Context, isPullList bool) { } var uid int64 = -1 - if ctx.IsSigned { + if ctx.IsLogged { uid = ctx.User.ID } @@ -197,7 +197,7 @@ func issues(ctx *context.Context, isPullList bool) { // Get posters. for i := range issues { - if !ctx.IsSigned { + if !ctx.IsLogged { issues[i].IsRead = true continue } @@ -587,7 +587,7 @@ func viewIssue(ctx *context.Context, isPullList bool) { } } - if ctx.IsSigned { + if ctx.IsLogged { // Update issue-user. if err = issue.ReadBy(ctx.User.ID); err != nil { ctx.Handle(500, "ReadBy", err) @@ -652,7 +652,7 @@ func viewIssue(ctx *context.Context, isPullList bool) { ctx.Data["Participants"] = participants ctx.Data["NumParticipants"] = len(participants) ctx.Data["Issue"] = issue - ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID)) + ctx.Data["IsIssueOwner"] = ctx.Repo.IsWriter() || (ctx.IsLogged && issue.IsPoster(ctx.User.ID)) ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login?redirect_to=" + ctx.Data["Link"].(string) ctx.HTML(200, ISSUE_VIEW) } @@ -687,7 +687,7 @@ func UpdateIssueTitle(ctx *context.Context) { return } - if !ctx.IsSigned || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter()) { + if !ctx.IsLogged || (!issue.IsPoster(ctx.User.ID) && !ctx.Repo.IsWriter()) { ctx.Error(403) return } @@ -714,7 +714,7 @@ func UpdateIssueContent(ctx *context.Context) { return } - if !ctx.IsSigned || (ctx.User.ID != issue.PosterID && !ctx.Repo.IsWriter()) { + if !ctx.IsLogged || (ctx.User.ID != issue.PosterID && !ctx.Repo.IsWriter()) { ctx.Error(403) return } @@ -843,7 +843,7 @@ func NewComment(ctx *context.Context, f form.CreateComment) { var comment *models.Comment defer func() { // Check if issue admin/poster changes the status of issue. - if (ctx.Repo.IsWriter() || (ctx.IsSigned && issue.IsPoster(ctx.User.ID))) && + if (ctx.Repo.IsWriter() || (ctx.IsLogged && issue.IsPoster(ctx.User.ID))) && (f.Status == "reopen" || f.Status == "close") && !(issue.IsPull && issue.PullRequest.HasMerged) { diff --git a/routers/repo/pull.go b/routers/repo/pull.go index b88500e8..15e283d1 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -153,7 +153,7 @@ func checkPullInfo(ctx *context.Context) *models.Issue { return nil } - if ctx.IsSigned { + if ctx.IsLogged { // Update issue-user. if err = issue.ReadBy(ctx.User.ID); err != nil { ctx.Handle(500, "ReadBy", err) diff --git a/routers/user/home.go b/routers/user/home.go index 745c2afa..431c196d 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -379,7 +379,7 @@ func showOrgProfile(ctx *context.Context) { count int64 err error ) - if ctx.IsSigned && !ctx.User.IsAdmin { + if ctx.IsLogged && !ctx.User.IsAdmin { repos, count, err = org.GetUserRepositories(ctx.User.ID, page, setting.UI.User.RepoPagingNum) if err != nil { ctx.Handle(500, "GetUserRepositories", err) @@ -387,7 +387,7 @@ func showOrgProfile(ctx *context.Context) { } ctx.Data["Repos"] = repos } else { - showPrivate := ctx.IsSigned && ctx.User.IsAdmin + showPrivate := ctx.IsLogged && ctx.User.IsAdmin repos, err = models.GetUserRepositories(&models.UserRepoOptions{ UserID: org.ID, Private: showPrivate, diff --git a/routers/user/profile.go b/routers/user/profile.go index baf9a941..649814f0 100644 --- a/routers/user/profile.go +++ b/routers/user/profile.go @@ -73,7 +73,7 @@ func Profile(ctx *context.Context) { ctx.Data["PageIsUserProfile"] = true ctx.Data["Owner"] = ctxUser - orgs, err := models.GetOrgsByUserID(ctxUser.ID, ctx.IsSigned && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)) + orgs, err := models.GetOrgsByUserID(ctxUser.ID, ctx.IsLogged && (ctx.User.IsAdmin || ctx.User.ID == ctxUser.ID)) if err != nil { ctx.Handle(500, "GetOrgsByUserIDDesc", err) return @@ -95,7 +95,7 @@ func Profile(ctx *context.Context) { page = 1 } - showPrivate := ctx.IsSigned && (ctxUser.ID == ctx.User.ID || ctx.User.IsAdmin) + showPrivate := ctx.IsLogged && (ctxUser.ID == ctx.User.ID || ctx.User.IsAdmin) ctx.Data["Repos"], err = models.GetUserRepositories(&models.UserRepoOptions{ UserID: ctxUser.ID, Private: showPrivate, diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index 33a58eae..71551ac7 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -90,7 +90,7 @@ <img class="ui mini image" src="{{AppSubURL}}/img/favicon.png"> </a> - {{if .IsSigned}} + {{if .IsLogged}} <a class="item{{if .PageIsDashboard}} active{{end}}" href="{{AppSubURL}}/">{{.i18n.Tr "dashboard"}}</a> <a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubURL}}/issues">{{.i18n.Tr "issues"}}</a> <a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubURL}}/pulls">{{.i18n.Tr "pull_requests"}}</a> @@ -106,7 +106,7 @@ </div> </div>*/}} - {{if .IsSigned}} + {{if .IsLogged}} <div class="right menu"> <div class="ui dropdown head link jump item poping up" data-content="{{.i18n.Tr "create_new"}}" data-variation="tiny inverted"> <span class="text"> @@ -120,7 +120,7 @@ <a class="item" href="{{AppSubURL}}/repo/migrate"> <i class="octicon octicon-repo-clone"></i> {{.i18n.Tr "new_migrate"}} </a> - {{if .SignedUser.CanCreateOrganization}} + {{if .LoggedUser.CanCreateOrganization}} <a class="item" href="{{AppSubURL}}/org/create"> <i class="octicon octicon-organization"></i> {{.i18n.Tr "new_org"}} </a> @@ -130,17 +130,17 @@ <div class="ui dropdown head link jump item poping up" tabindex="-1" data-content="{{.i18n.Tr "user_profile_and_more"}}" data-variation="tiny inverted"> <span class="text avatar"> - <img class="ui small rounded image" src="{{.SignedUser.RelAvatarLink}}"> + <img class="ui small rounded image" src="{{.LoggedUser.RelAvatarLink}}"> <span class="sr-only">{{.i18n.Tr "user_profile_and_more"}}</span> <i class="octicon octicon-triangle-down" tabindex="-1"></i> </span> <div class="menu" tabindex="-1"> <div class="ui header"> - {{.i18n.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> + {{.i18n.Tr "signed_in_as"}} <strong>{{.LoggedUser.Name}}</strong> </div> <div class="divider"></div> - <a class="item" href="{{AppSubURL}}/{{.SignedUser.Name}}"> + <a class="item" href="{{AppSubURL}}/{{.LoggedUser.Name}}"> <i class="octicon octicon-person"></i> {{.i18n.Tr "your_profile"}}<!-- Your profile --> </a> diff --git a/templates/explore/users.tmpl b/templates/explore/users.tmpl index c13ccc69..6f1b2ee8 100644 --- a/templates/explore/users.tmpl +++ b/templates/explore/users.tmpl @@ -16,7 +16,7 @@ {{if .Location}} <i class="octicon octicon-location"></i> {{.Location}} {{end}} - {{if and .Email $.IsSigned}} + {{if and .Email $.IsLogged}} <i class="octicon octicon-mail"></i> <a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a> {{end}} diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index d7514d8b..67ab1f76 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -28,10 +28,10 @@ {{ $isPublic := .IsPublicMember $.Org.ID}} {{if $isPublic}} <strong>{{$.i18n.Tr "org.members.public"}}</strong> - {{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{$.i18n.Tr "org.members.public_helper"}}</a>){{end}} + {{if or (eq $.LoggedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/private?uid={{.ID}}">{{$.i18n.Tr "org.members.public_helper"}}</a>){{end}} {{else}} <strong>{{$.i18n.Tr "org.members.private"}}</strong> - {{if or (eq $.SignedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/public?uid={{.ID}}">{{$.i18n.Tr "org.members.private_helper"}}</a>){{end}} + {{if or (eq $.LoggedUser.ID .ID) $.IsOrganizationOwner}}(<a href="{{$.OrgLink}}/members/action/public?uid={{.ID}}">{{$.i18n.Tr "org.members.private_helper"}}</a>){{end}} {{end}} </div> </div> @@ -45,7 +45,7 @@ </div> <div class="ui four wide column"> <div class="text right"> - {{if eq $.SignedUser.ID .ID}} + {{if eq $.LoggedUser.ID .ID}} <a class="ui red small button" href="{{$.OrgLink}}/members/action/leave?uid={{.ID}}">{{$.i18n.Tr "org.members.leave"}}</a> {{else if $.IsOrganizationOwner}} <a class="ui red small button" href="{{$.OrgLink}}/members/action/remove?uid={{.ID}}">{{$.i18n.Tr "org.members.remove"}}</a> diff --git a/templates/org/settings/options.tmpl b/templates/org/settings/options.tmpl index dcd8d33b..fdf323c0 100644 --- a/templates/org/settings/options.tmpl +++ b/templates/org/settings/options.tmpl @@ -33,7 +33,7 @@ <input id="location" name="location" value="{{.Org.Location}}"> </div> - {{if .SignedUser.IsAdmin}} + {{if .LoggedUser.IsAdmin}} <div class="ui divider"></div> <div class="inline field {{if .Err_MaxRepoCreation}}error{{end}}"> diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index 1c707e93..ca5aceea 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -26,7 +26,7 @@ <div class="ui bottom attached segment"> <form class="ui form" id="add-member-form" action="{{$.OrgLink}}/teams/{{$.Team.LowerName}}/action/add" method="post"> {{.CSRFTokenHTML}} - <input type="hidden" name="uid" value="{{.SignedUser.ID}}"> + <input type="hidden" name="uid" value="{{.LoggedUser.ID}}"> <div class="inline field ui left"> <div id="search-user-box"> <div class="ui input"> diff --git a/templates/org/team/sidebar.tmpl b/templates/org/team/sidebar.tmpl index 02cb8d7d..12f989a6 100644 --- a/templates/org/team/sidebar.tmpl +++ b/templates/org/team/sidebar.tmpl @@ -2,10 +2,10 @@ <h4 class="ui top attached header"> <strong>{{.Team.Name}}</strong> <div class="ui right"> - {{if .Team.IsMember $.SignedUser.ID}} - <a class="ui red tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.SignedUser.ID}}&page=team">{{$.i18n.Tr "org.teams.leave"}}</a> + {{if .Team.IsMember $.LoggedUser.ID}} + <a class="ui red tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/leave?uid={{$.LoggedUser.ID}}&page=team">{{$.i18n.Tr "org.teams.leave"}}</a> {{else if .IsOrganizationOwner}} - <a class="ui blue tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join?uid={{$.SignedUser.ID}}&page=team">{{$.i18n.Tr "org.teams.join"}}</a> + <a class="ui blue tiny button" href="{{.OrgLink}}/teams/{{.Team.LowerName}}/action/join?uid={{$.LoggedUser.ID}}&page=team">{{$.i18n.Tr "org.teams.join"}}</a> {{end}} </div> </h4> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 87141811..2b4445ca 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -16,10 +16,10 @@ <div class="ui top attached header"> <a class="text black" href="{{$.OrgLink}}/teams/{{.LowerName}}"><strong>{{.Name}}</strong></a> <div class="ui right"> - {{if .IsMember $.SignedUser.ID}} - <a class="ui red small button" href="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave?uid={{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</a> + {{if .IsMember $.LoggedUser.ID}} + <a class="ui red small button" href="{{$.OrgLink}}/teams/{{.LowerName}}/action/leave?uid={{$.LoggedUser.ID}}">{{$.i18n.Tr "org.teams.leave"}}</a> {{else if $.IsOrganizationOwner}} - <a class="ui blue small button" href="{{$.OrgLink}}/teams/{{.LowerName}}/action/join?uid={{$.SignedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</a> + <a class="ui blue small button" href="{{$.OrgLink}}/teams/{{.LowerName}}/action/join?uid={{$.LoggedUser.ID}}">{{$.i18n.Tr "org.teams.join"}}</a> {{end}} </div> </div> diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 06daa360..25c8dc27 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -19,9 +19,9 @@ </span> <i class="dropdown icon"></i> <div class="menu"> - <div class="item" data-value="{{.SignedUser.ID}}"> - <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> - {{.SignedUser.ShortName 20}} + <div class="item" data-value="{{.LoggedUser.ID}}"> + <img class="ui mini image" src="{{.LoggedUser.RelAvatarLink}}"> + {{.LoggedUser.ShortName 20}} </div> {{range .Orgs}} <div class="item" data-value="{{.ID}}"> diff --git a/templates/repo/diff/page.tmpl b/templates/repo/diff/page.tmpl index 4d2f6bc1..eae67b7f 100644 --- a/templates/repo/diff/page.tmpl +++ b/templates/repo/diff/page.tmpl @@ -14,7 +14,7 @@ <div class="ui attached info segment"> {{if .Author}} <img class="ui avatar image" src="{{.Author.RelAvatarLink}}" /> - <a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a> {{if .IsSigned}}<{{.Commit.Author.Email}}>{{end}} + <a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a> {{if .IsLogged}}<{{.Commit.Author.Email}}>{{end}} {{else}} <img class="ui avatar image" src="{{AvatarLink .Commit.Author.Email}}" /> <strong>{{.Commit.Author.Name}}</strong> diff --git a/templates/repo/editor/commit_form.tmpl b/templates/repo/editor/commit_form.tmpl index 96b0dcbd..6aee9f1d 100644 --- a/templates/repo/editor/commit_form.tmpl +++ b/templates/repo/editor/commit_form.tmpl @@ -1,5 +1,5 @@ <div class="commit-form-wrapper"> - <img width="48" height="48" class="ui image commit-avatar" src="{{.SignedUser.RelAvatarLink}}"> + <img width="48" height="48" class="ui image commit-avatar" src="{{.LoggedUser.RelAvatarLink}}"> <div class="commit-form"> <h3>{{.i18n.Tr "repo.editor.commit_changes"}}</h3> <div class="field"> diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 3a2d48f4..cce2dbfc 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -33,7 +33,7 @@ </div> {{if .CanBeForked}} <div class="ui labeled button" tabindex="0"> - <a class="ui basic button {{if eq .OwnerID $.SignedUserID}}poping up{{end}}" href="{{AppSubURL}}/repo/fork/{{.ID}}"> + <a class="ui basic button {{if eq .OwnerID $.LoggedUserID}}poping up{{end}}" href="{{AppSubURL}}/repo/fork/{{.ID}}"> <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}} </a> <a class="ui basic label" href="{{.Link}}/forks"> diff --git a/templates/repo/issue/new_form.tmpl b/templates/repo/issue/new_form.tmpl index 2bbb81bb..d3f9f710 100644 --- a/templates/repo/issue/new_form.tmpl +++ b/templates/repo/issue/new_form.tmpl @@ -8,8 +8,8 @@ <div class="twelve wide column"> <div class="ui comments"> <div class="comment"> - <a class="avatar" href="{{.SignedUser.HomeLink}}"> - <img src="{{.SignedUser.RelAvatarLink}}"> + <a class="avatar" href="{{.LoggedUser.HomeLink}}"> + <img src="{{.LoggedUser.RelAvatarLink}}"> </a> <div class="ui segment content"> <div class="field"> diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index 2bb40409..88f66ef9 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -79,7 +79,7 @@ {{end}} </div> {{end}} - {{if or $.IsRepositoryAdmin (eq .Poster.ID $.SignedUserID)}} + {{if or $.IsRepositoryAdmin (eq .Poster.ID $.LoggedUserID)}} <div class="item action"> <a class="edit-content" href="#"><i class="octicon octicon-pencil"></i></a> <a class="delete-comment" href="#" data-comment-id={{.HashTag}} data-url="{{$.RepoLink}}/comments/{{.ID}}/delete" data-locale="{{$.i18n.Tr "repo.issues.delete_comment_confirm"}}"><i class="octicon octicon-x"></i></a> @@ -216,10 +216,10 @@ </div> {{end}} - {{if .IsSigned}} + {{if .IsLogged}} <div class="comment form"> - <a class="avatar" href="{{.SignedUser.HomeLink}}"> - <img src="{{.SignedUser.RelAvatarLink}}"> + <a class="avatar" href="{{.LoggedUser.HomeLink}}"> + <img src="{{.LoggedUser.RelAvatarLink}}"> </a> <div class="content"> <form class="ui segment form" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post"> diff --git a/templates/repo/migrate.tmpl b/templates/repo/migrate.tmpl index 608f0ca3..e10b07cd 100644 --- a/templates/repo/migrate.tmpl +++ b/templates/repo/migrate.tmpl @@ -50,9 +50,9 @@ </span> <i class="dropdown icon"></i> <div class="menu"> - <div class="item" data-value="{{.SignedUser.ID}}"> - <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> - {{.SignedUser.ShortName 20}} + <div class="item" data-value="{{.LoggedUser.ID}}"> + <img class="ui mini image" src="{{.LoggedUser.RelAvatarLink}}"> + {{.LoggedUser.ShortName 20}} </div> {{range .Orgs}} <div class="item" data-value="{{.ID}}"> diff --git a/templates/repo/pulls/fork.tmpl b/templates/repo/pulls/fork.tmpl index eda3d027..f10c2aa8 100644 --- a/templates/repo/pulls/fork.tmpl +++ b/templates/repo/pulls/fork.tmpl @@ -19,12 +19,12 @@ </span> <i class="dropdown icon"></i> <div class="menu"> - <div class="item" data-value="{{.SignedUser.ID}}"> - <img class="ui mini image" src="{{.SignedUser.RelAvatarLink}}"> - {{.SignedUser.ShortName 20}} + <div class="item" data-value="{{.LoggedUser.ID}}"> + <img class="ui mini image" src="{{.LoggedUser.RelAvatarLink}}"> + {{.LoggedUser.ShortName 20}} </div> {{range .Orgs}} - {{if .IsOwnedBy $.SignedUser.ID}} + {{if .IsOwnedBy $.LoggedUser.ID}} <div class="item" data-value="{{.ID}}"> <img class="ui mini image" src="{{.RelAvatarLink}}"> {{.ShortName 20}} diff --git a/templates/repo/settings/nav.tmpl b/templates/repo/settings/nav.tmpl index 97df429f..81d0fdf1 100644 --- a/templates/repo/settings/nav.tmpl +++ b/templates/repo/settings/nav.tmpl @@ -5,7 +5,7 @@ <li {{if .PageIsSettingsOptions}}class="current"{{end}}><a href="{{.RepoLink}}/settings">{{.i18n.Tr "repo.settings.options"}}</a></li> <li {{if .PageIsSettingsCollaboration}}class="current"{{end}}><a href="{{.RepoLink}}/settings/collaboration">{{.i18n.Tr "repo.settings.collaboration"}}</a></li> <li {{if .PageIsSettingsHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks">{{.i18n.Tr "repo.settings.hooks"}}</a></li> - {{if or .SignedUser.AllowGitHook .SignedUser.IsAdmin}} + {{if or .LoggedUser.AllowGitHook .LoggedUser.IsAdmin}} <li {{if .PageIsSettingsGitHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks/git">{{.i18n.Tr "repo.settings.githooks"}}</a></li> {{end}} <li {{if .PageIsSettingsKeys}}class="current"{{end}}><a href="{{.RepoLink}}/settings/keys">{{.i18n.Tr "repo.settings.deploy_keys"}}</a></li> diff --git a/templates/repo/settings/navbar.tmpl b/templates/repo/settings/navbar.tmpl index f43b3caf..9d3e33ca 100644 --- a/templates/repo/settings/navbar.tmpl +++ b/templates/repo/settings/navbar.tmpl @@ -15,7 +15,7 @@ <a class="{{if .PageIsSettingsHooks}}active{{end}} item" href="{{.RepoLink}}/settings/hooks"> {{.i18n.Tr "repo.settings.hooks"}} </a> - {{if .SignedUser.CanEditGitHook}} + {{if .LoggedUser.CanEditGitHook}} <a class="{{if .PageIsSettingsGitHooks}}active{{end}} item" href="{{.RepoLink}}/settings/hooks/git"> {{.i18n.Tr "repo.settings.githooks"}} </a> diff --git a/templates/user/auth/activate.tmpl b/templates/user/auth/activate.tmpl index 35fdc1ba..471d3fcd 100644 --- a/templates/user/auth/activate.tmpl +++ b/templates/user/auth/activate.tmpl @@ -15,7 +15,7 @@ {{else if .ResendLimited}} <p class="center">{{.i18n.Tr "auth.resent_limit_prompt"}}</p> {{else}} - <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .SignedUser.Email .Hours | Str2html}}</p> + <p>{{.i18n.Tr "auth.confirmation_mail_sent_prompt" .LoggedUser.Email .Hours | Str2html}}</p> {{end}} {{else}} {{if .IsSendRegisterMail}} @@ -23,7 +23,7 @@ {{else if .IsActivateFailed}} <p>{{.i18n.Tr "auth.invalid_code"}}</p> {{else}} - <p>{{.i18n.Tr "auth.has_unconfirmed_mail" .SignedUser.Name .SignedUser.Email | Str2html}}</p> + <p>{{.i18n.Tr "auth.has_unconfirmed_mail" .LoggedUser.Name .LoggedUser.Email | Str2html}}</p> <div class="ui divider"></div> <div class="text right"> <button class="ui blue button">{{.i18n.Tr "auth.resend_mail"}}</button> diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index d2600168..88d69c8f 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -10,9 +10,9 @@ {{.i18n.Tr "home.switch_dashboard_context"}} </div> <div class="items"> - <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item" href="{{AppSubURL}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{end}}"> - <img class="ui avatar image" src="{{.SignedUser.RelAvatarLink}}"> - {{.SignedUser.Name}} + <a class="{{if eq .ContextUser.ID .LoggedUser.ID}}active selected{{end}} item" href="{{AppSubURL}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{end}}"> + <img class="ui avatar image" src="{{.LoggedUser.RelAvatarLink}}"> + {{.LoggedUser.Name}} </a> {{range .Orgs}} <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" href="{{AppSubURL}}/org/{{.Name}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else}}dashboard{{end}}"> diff --git a/templates/user/meta/header.tmpl b/templates/user/meta/header.tmpl index 36072e8a..3d1fce03 100644 --- a/templates/user/meta/header.tmpl +++ b/templates/user/meta/header.tmpl @@ -8,9 +8,9 @@ <div class="ui right"> {{if or $.PageIsFollowers $.PageIsFollowing}} - {{if and $.IsSigned (ne $.SignedUserName .Name)}} + {{if and $.IsLogged (ne $.LoggedUserName .Name)}} <div class="follow"> - {{if $.SignedUser.IsFollowing .ID}} + {{if $.LoggedUser.IsFollowing .ID}} <a class="ui small basic red button" href="{{.HomeLink}}/action/unfollow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{$.i18n.Tr "user.unfollow"}}</a> {{else}} <a class="ui small basic green button" href="{{.HomeLink}}/action/follow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{$.i18n.Tr "user.follow"}}</a> diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 4dced1d4..27c30db5 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -4,7 +4,7 @@ <div class="ui grid"> <div class="ui five wide column"> <div class="ui card"> - {{if eq .SignedUserName .Owner.Name}} + {{if eq .LoggedUserName .Owner.Name}} <a class="image poping up" href="{{AppSubURL}}/user/settings/avatar" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center"> <img src="{{.Owner.RelAvatarLink}}?s=290" title="{{.Owner.Name}}"/> </a> @@ -22,7 +22,7 @@ {{if .Owner.Location}} <li><i class="octicon octicon-location"></i> {{.Owner.Location}}</li> {{end}} - {{if and .Owner.Email .IsSigned}} + {{if and .Owner.Email .IsLogged}} <li> <i class="octicon octicon-mail"></i> <a href="mailto:{{.Owner.Email}}" rel="nofollow">{{.Owner.Email}}</a> @@ -60,9 +60,9 @@ {{end}} </li> {{end}} - {{if and .IsSigned (ne .SignedUserName .Owner.Name)}} + {{if and .IsLogged (ne .LoggedUserName .Owner.Name)}} <li class="follow"> - {{if .SignedUser.IsFollowing .Owner.ID}} + {{if .LoggedUser.IsFollowing .Owner.ID}} <a class="ui basic red button" href="{{.Link}}/action/unfollow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.unfollow"}}</a> {{else}} <a class="ui basic green button" href="{{.Link}}/action/follow?redirect_to={{$.Link}}"><i class="octicon octicon-person"></i> {{.i18n.Tr "user.follow"}}</a> diff --git a/templates/user/settings/avatar.tmpl b/templates/user/settings/avatar.tmpl index 7ab9c274..ee1300c8 100644 --- a/templates/user/settings/avatar.tmpl +++ b/templates/user/settings/avatar.tmpl @@ -15,19 +15,19 @@ {{if not DisableGravatar}} <div class="inline field"> <div class="ui radio checkbox"> - <input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}> + <input name="source" value="lookup" type="radio" {{if not .LoggedUser.UseCustomAvatar}}checked{{end}}> <label>{{.i18n.Tr "settings.lookup_avatar_by_mail"}}</label> </div> </div> <div class="field {{if .Err_Gravatar}}error{{end}}"> <label for="gravatar">Avatar {{.i18n.Tr "email"}}</label> - <input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" /> + <input id="gravatar" name="gravatar" value="{{.LoggedUser.AvatarEmail}}" /> </div> {{end}} <div class="inline field"> <div class="ui radio checkbox"> - <input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}> + <input name="source" value="local" type="radio" {{if .LoggedUser.UseCustomAvatar}}checked{{end}}> <label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label> </div> </div> diff --git a/templates/user/settings/password.tmpl b/templates/user/settings/password.tmpl index 8d702f59..acab4958 100644 --- a/templates/user/settings/password.tmpl +++ b/templates/user/settings/password.tmpl @@ -9,7 +9,7 @@ {{.i18n.Tr "settings.change_password"}} </h4> <div class="ui attached segment"> - {{if .SignedUser.IsLocal}} + {{if .LoggedUser.IsLocal}} <form class="ui form" action="{{.Link}}" method="post"> {{.CSRFTokenHTML}} <div class="required field {{if .Err_OldPassword}}error{{end}}"> diff --git a/templates/user/settings/profile.tmpl b/templates/user/settings/profile.tmpl index 2952907d..12f21c8f 100644 --- a/templates/user/settings/profile.tmpl +++ b/templates/user/settings/profile.tmpl @@ -14,8 +14,8 @@ {{.CSRFTokenHTML}} <div class="required field {{if .Err_Name}}error{{end}}"> <label for="username">{{.i18n.Tr "username"}}<span class="text red {{if eq .name .origin_name}}hide{{end}}" id="name-change-prompt"> {{.i18n.Tr "settings.change_username_prompt"}}</span></label> - <input id="username" name="name" value="{{.name}}" data-name="{{.origin_name}}" autofocus required {{if not .SignedUser.IsLocal}}readonly{{end}}> - {{if not .SignedUser.IsLocal}} + <input id="username" name="name" value="{{.name}}" data-name="{{.origin_name}}" autofocus required {{if not .LoggedUser.IsLocal}}readonly{{end}}> + {{if not .LoggedUser.IsLocal}} <p class="help text blue">{{$.i18n.Tr "settings.password_username_disabled"}}</p> {{end}} </div> diff --git a/templates/user/settings/repositories.tmpl b/templates/user/settings/repositories.tmpl index 416deca5..1537f449 100644 --- a/templates/user/settings/repositories.tmpl +++ b/templates/user/settings/repositories.tmpl @@ -28,7 +28,7 @@ {{.Owner.Name}}/{{.Name}} </a> <span class="ui text light grey">{{.Size | FileSize}}</span> - {{if not (eq .OwnerID $.SignedUserID)}} + {{if not (eq .OwnerID $.LoggedUserID)}} <div class="right floated content"> <a class="ui red tiny button inline text-thin delete-button" href="" data-url="{{$.Link}}/leave" data-id="{{.ID}}">{{$.i18n.Tr "settings.repos.leave"}}</a> </div> |