mirror of
https://github.com/cuigh/swirl
synced 2024-12-28 14:51:57 +00:00
Synchronize with lastest version of auxo
This commit is contained in:
parent
ef548fca70
commit
10fcc1452c
@ -43,7 +43,7 @@ func (b *userBiz) Create(user *model.User, ctxUser web.User) (err error) {
|
|||||||
user.CreatedAt = time.Now()
|
user.CreatedAt = time.Now()
|
||||||
user.UpdatedAt = user.CreatedAt
|
user.UpdatedAt = user.CreatedAt
|
||||||
if user.Type == model.UserTypeInternal {
|
if user.Type == model.UserTypeInternal {
|
||||||
user.Password, user.Salt, err = password.Get(user.Password)
|
user.Password, user.Salt, err = password.Generate(user.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ func (b *userBiz) UpdatePassword(id, oldPwd, newPwd string) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pwd, salt, err = password.Get(newPwd)
|
pwd, salt, err = password.Generate(newPwd)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
|
web:
|
||||||
|
mode: release
|
||||||
|
|
||||||
swirl:
|
swirl:
|
||||||
docker_endpoint: tcp://docker-proxy:2375
|
docker_endpoint: tcp://docker-proxy:2375
|
||||||
|
@ -2,7 +2,9 @@ name: swirl
|
|||||||
banner: false
|
banner: false
|
||||||
|
|
||||||
web:
|
web:
|
||||||
address: ':8001'
|
# mode: develop
|
||||||
|
entries:
|
||||||
|
- address: :8001
|
||||||
authorize: '?'
|
authorize: '?'
|
||||||
|
|
||||||
swirl:
|
swirl:
|
||||||
|
36
main.go
36
main.go
@ -24,7 +24,7 @@ func main() {
|
|||||||
misc.BindOptions()
|
misc.BindOptions()
|
||||||
|
|
||||||
app.Name = "Swirl"
|
app.Name = "Swirl"
|
||||||
app.Version = "0.6.2"
|
app.Version = "0.6.3"
|
||||||
app.Desc = "A web management UI for Docker, focused on swarm cluster"
|
app.Desc = "A web management UI for Docker, focused on swarm cluster"
|
||||||
app.Action = func(ctx *app.Context) {
|
app.Action = func(ctx *app.Context) {
|
||||||
misc.LoadOptions()
|
misc.LoadOptions()
|
||||||
@ -40,24 +40,24 @@ func server() *web.Server {
|
|||||||
panic(fmt.Sprintf("Load setting failed: %v", err))
|
panic(fmt.Sprintf("Load setting failed: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// customize error handler
|
|
||||||
web.DefaultErrorHandler.OnCode(http.StatusNotFound, func(ctx web.Context, err error) {
|
|
||||||
if ctx.IsAJAX() {
|
|
||||||
ctx.Status(http.StatusNotFound).HTML(http.StatusText(http.StatusNotFound))
|
|
||||||
} else {
|
|
||||||
ctx.Render("404", nil)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
web.DefaultErrorHandler.OnCode(http.StatusForbidden, func(ctx web.Context, err error) {
|
|
||||||
if ctx.IsAJAX() {
|
|
||||||
ctx.Status(http.StatusForbidden).HTML("You do not have permission to perform this operation")
|
|
||||||
} else {
|
|
||||||
ctx.Render("403", nil)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ws := web.Auto()
|
ws := web.Auto()
|
||||||
|
|
||||||
|
// customize error handler
|
||||||
|
ws.ErrorHandler.OnCode(http.StatusNotFound, func(ctx web.Context, err error) {
|
||||||
|
if ctx.IsAJAX() {
|
||||||
|
ctx.Status(http.StatusNotFound).HTML(http.StatusText(http.StatusNotFound)) // nolint: gas
|
||||||
|
} else {
|
||||||
|
ctx.Status(http.StatusNotFound).Render("404", nil) // nolint: gas
|
||||||
|
}
|
||||||
|
})
|
||||||
|
ws.ErrorHandler.OnCode(http.StatusForbidden, func(ctx web.Context, err error) {
|
||||||
|
if ctx.IsAJAX() {
|
||||||
|
ctx.Status(http.StatusForbidden).HTML("You do not have permission to perform this operation") // nolint: gas
|
||||||
|
} else {
|
||||||
|
ctx.Status(http.StatusForbidden).Render("403", nil) // nolint: gas
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// set render
|
// set render
|
||||||
ws.Validator = &valid.Validator{Tag: "valid"}
|
ws.Validator = &valid.Validator{Tag: "valid"}
|
||||||
ws.Renderer = jet.New().SetDebug(config.GetBool("debug")).
|
ws.Renderer = jet.New().SetDebug(config.GetBool("debug")).
|
||||||
@ -72,7 +72,7 @@ func server() *web.Server {
|
|||||||
ws.Use(filter.NewRecover())
|
ws.Use(filter.NewRecover())
|
||||||
|
|
||||||
// register static handlers
|
// register static handlers
|
||||||
ws.Static("/assets", filepath.Join(filepath.Dir(app.GetPath()), "assets"))
|
ws.Static("/assets", filepath.Join(filepath.Dir(app.Path()), "assets"))
|
||||||
|
|
||||||
// create biz group
|
// create biz group
|
||||||
form := &auth.Form{
|
form := &auth.Form{
|
||||||
|
@ -138,7 +138,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<button type="submit" class="button is-primary">{{ i18n("button.submit") }}</button>
|
<button type="submit" class="button is-primary">{{ i18n("button.submit") }}</button>
|
||||||
<button type="button" class="button dismiss">{{ i18n("field.cancel") }}</button>
|
<button type="button" class="button dismiss">{{ i18n("button.cancel") }}</button>
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user