@@ -345,7 +345,12 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
345
345
cfg .Section ("security" ).Key ("INSTALL_LOCK" ).SetValue ("true" )
346
346
cfg .Section ("security" ).Key ("SECRET_KEY" ).SetValue (base .GetRandomString (15 ))
347
347
348
- os .MkdirAll (filepath .Dir (setting .CustomConf ), os .ModePerm )
348
+ err := os .MkdirAll (filepath .Dir (setting .CustomConf ), os .ModePerm )
349
+ if err != nil {
350
+ ctx .RenderWithErr (ctx .Tr ("install.save_config_failed" , err ), INSTALL , & form )
351
+ return
352
+ }
353
+
349
354
if err := cfg .SaveTo (setting .CustomConf ); err != nil {
350
355
ctx .RenderWithErr (ctx .Tr ("install.save_config_failed" , err ), INSTALL , & form )
351
356
return
@@ -375,8 +380,14 @@ func InstallPost(ctx *context.Context, form auth.InstallForm) {
375
380
}
376
381
377
382
// Auto-login for admin
378
- ctx .Session .Set ("uid" , u .ID )
379
- ctx .Session .Set ("uname" , u .Name )
383
+ if err := ctx .Session .Set ("uid" , u .ID ); err != nil {
384
+ ctx .RenderWithErr (ctx .Tr ("install.save_config_failed" , err ), INSTALL , & form )
385
+ return
386
+ }
387
+ if err := ctx .Session .Set ("uname" , u .Name ); err != nil {
388
+ ctx .RenderWithErr (ctx .Tr ("install.save_config_failed" , err ), INSTALL , & form )
389
+ return
390
+ }
380
391
}
381
392
382
393
log .Info ("First-time run install finished!" )
0 commit comments