mirror of
https://github.com/cuigh/swirl
synced 2024-12-27 22:32:49 +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.UpdatedAt = user.CreatedAt
|
||||
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 {
|
||||
return
|
||||
}
|
||||
@ -112,7 +112,7 @@ func (b *userBiz) UpdatePassword(id, oldPwd, newPwd string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
pwd, salt, err = password.Get(newPwd)
|
||||
pwd, salt, err = password.Generate(newPwd)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -1,2 +1,5 @@
|
||||
web:
|
||||
mode: release
|
||||
|
||||
swirl:
|
||||
docker_endpoint: tcp://docker-proxy:2375
|
||||
|
@ -2,7 +2,9 @@ name: swirl
|
||||
banner: false
|
||||
|
||||
web:
|
||||
address: ':8001'
|
||||
# mode: develop
|
||||
entries:
|
||||
- address: :8001
|
||||
authorize: '?'
|
||||
|
||||
swirl:
|
||||
|
36
main.go
36
main.go
@ -24,7 +24,7 @@ func main() {
|
||||
misc.BindOptions()
|
||||
|
||||
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.Action = func(ctx *app.Context) {
|
||||
misc.LoadOptions()
|
||||
@ -40,24 +40,24 @@ func server() *web.Server {
|
||||
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()
|
||||
|
||||
// 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
|
||||
ws.Validator = &valid.Validator{Tag: "valid"}
|
||||
ws.Renderer = jet.New().SetDebug(config.GetBool("debug")).
|
||||
@ -72,7 +72,7 @@ func server() *web.Server {
|
||||
ws.Use(filter.NewRecover())
|
||||
|
||||
// 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
|
||||
form := &auth.Form{
|
||||
|
@ -138,7 +138,7 @@
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user