mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-02-12 16:12:44 +00:00
fix install lock db
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
This commit is contained in:
2
RELEASE.md
Normal file
2
RELEASE.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# 1.1.9
|
||||
- Fixed bug in install.
|
||||
@@ -143,16 +143,19 @@ type Install struct {
|
||||
// Install completes the installation by setting the initial administrators and options
|
||||
func (in *Install) Install(g *gin.Context) {
|
||||
tx := in.DB.Begin()
|
||||
var committed bool
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
tx.Rollback()
|
||||
if !committed {
|
||||
tx.Rollback()
|
||||
}
|
||||
}
|
||||
}()
|
||||
ok := in.install(g, tx)
|
||||
if !ok {
|
||||
if tx.Rollback().Error != nil {
|
||||
if err := tx.Rollback().Error; err != nil {
|
||||
in.Logger.Errorw("failed to install - could not rollback transaction",
|
||||
"error", tx.Rollback().Error,
|
||||
"error", err,
|
||||
)
|
||||
}
|
||||
return
|
||||
@@ -165,6 +168,7 @@ func (in *Install) Install(g *gin.Context) {
|
||||
in.Response.ServerError(g)
|
||||
return
|
||||
}
|
||||
committed = true
|
||||
// the admin user changed username and password
|
||||
// however as the install process is a special case, we wont
|
||||
// require re-authentication
|
||||
|
||||
@@ -37,7 +37,7 @@ func (o *Option) updateByKey(
|
||||
d *gorm.DB,
|
||||
option *model.Option,
|
||||
) error {
|
||||
result := o.DB.
|
||||
result := d.
|
||||
Model(&database.Option{}).
|
||||
Where("key = ?", option.Key.String()).
|
||||
Update("value", option.Value.String())
|
||||
|
||||
Reference in New Issue
Block a user