Add utilisateur nav menu
This commit is contained in:
parent
a4473eb283
commit
87d78fa64b
|
|
@ -17,6 +17,11 @@ type AddTempController struct {
|
|||
}
|
||||
|
||||
func (c *AddTempController) Prepare() {
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess != nil {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
c.Data["version"] = variables.Version
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ type MainController struct {
|
|||
}
|
||||
|
||||
func (c *MainController) Prepare() {
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess != nil {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
c.Data["version"] = variables.Version
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,13 @@ type ViewRelayController struct {
|
|||
}
|
||||
|
||||
func (c *ViewRelayController) Prepare() {
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess == nil {
|
||||
c.Redirect(variables.LoginRoute, 302)
|
||||
} else {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
c.Data["IsViewRelay"] = true;
|
||||
c.Data["version"] = variables.Version
|
||||
}
|
||||
|
|
@ -76,7 +83,10 @@ type AddRelayController struct {
|
|||
}
|
||||
|
||||
func (c *AddRelayController) Prepare() {
|
||||
c.Data["version"] = variables.Version
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess == nil {
|
||||
c.Redirect(variables.LoginRoute, 302)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *AddRelayController) Get() {
|
||||
|
|
@ -98,6 +108,12 @@ type CommandRelayController struct {
|
|||
beego.Controller
|
||||
}
|
||||
|
||||
func (c *CommandRelayController) Prepare() {
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess == nil {
|
||||
c.Redirect(variables.LoginRoute, 302)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CommandRelayController) Post() {
|
||||
mac := c.Ctx.Input.Param(":sensor")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ func (c *SensorsController) Prepare() {
|
|||
sess := c.GetSession(variables.SessionName)
|
||||
if sess == nil {
|
||||
c.Redirect(variables.LoginRoute, 302)
|
||||
} else {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
c.Data["IsSensor"] = true
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ func (c *UserController) Prepare() {
|
|||
sess := c.GetSession(variables.SessionName)
|
||||
if sess == nil {
|
||||
c.Redirect(variables.LoginRoute, 302)
|
||||
} else {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
// c.Data["IsSensor"] = true
|
||||
c.Data["IsUser"] = true
|
||||
c.Data["version"] = variables.Version
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ type ViewTempController struct {
|
|||
}
|
||||
|
||||
func (c *ViewTempController) Prepare() {
|
||||
sess := c.GetSession(variables.SessionName)
|
||||
if sess != nil {
|
||||
c.Data["IsAuthentificated"] = true
|
||||
}
|
||||
|
||||
c.Data["IsViewTemp"] = true
|
||||
c.Data["version"] = variables.Version
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@
|
|||
><a href="/view/elec">Consommation electrique</a></li> -->
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{if .IsAuthentificated}}
|
||||
<li
|
||||
{{if .IsUser}}
|
||||
class="active"
|
||||
{{end}}
|
||||
><a href="/user">Utilisateur</a></li>
|
||||
{{end}}
|
||||
<li
|
||||
{{if .IsSensor}}
|
||||
class="active"
|
||||
|
|
|
|||
Loading…
Reference in New Issue