diff --git a/config.json b/config.json index 680213df5..f0feb790e 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,7 @@ "FeaturedWeapons": 2, "DevMode": true, "DevModeOptions": { + "AutoCreateAccount": true, "EnableLauncherServer": false, "HideLoginNotice": false, "LoginNotice": "
Welcome to Erupe SU9.1 Beta!
Erupe is experimental software, we are not liable for any
issues caused by installing the software!

■Report bugs on Discord!

■Test everything!

■Don't talk to softlocking NPCs!

■Fork the code on GitHub!

Thank you to all of the contributors,

this wouldn't exist without you.", diff --git a/config/config.go b/config/config.go index e040c7808..48da57344 100644 --- a/config/config.go +++ b/config/config.go @@ -30,6 +30,7 @@ type Config struct { // DevModeOptions holds various debug/temporary options for use while developing Erupe. type DevModeOptions struct { + AutoCreateAccount bool // Automatically create accounts if they don't exist HideLoginNotice bool // Hide the Erupe notice on login LoginNotice string // MHFML string of the login notice displayed CleanDB bool // Automatically wipes the DB on server reset. diff --git a/server/signserver/session.go b/server/signserver/session.go index f52ebb401..6b2e38b8c 100644 --- a/server/signserver/session.go +++ b/server/signserver/session.go @@ -93,12 +93,15 @@ func (s *Session) handleDSGNRequest(bf *byteframe.ByteFrame) error { s.logger.Info("Account not found", zap.String("reqUsername", reqUsername)) serverRespBytes = makeSignInFailureResp(SIGN_EAUTH) - // HACK(Andoryuuta): Create a new account if it doesn't exit. - s.logger.Info("Creating account", zap.String("reqUsername", reqUsername), zap.String("reqPassword", reqPassword)) - err = s.server.registerDBAccount(reqUsername, reqPassword) - if err != nil { - s.logger.Info("Error on creating new account", zap.Error(err)) - serverRespBytes = makeSignInFailureResp(SIGN_EABORT) + if s.server.erupeConfig.DevMode && s.server.erupeConfig.DevModeOptions.AutoCreateAccount { + s.logger.Info("Creating account", zap.String("reqUsername", reqUsername), zap.String("reqPassword", reqPassword)) + err = s.server.registerDBAccount(reqUsername, reqPassword) + if err != nil { + s.logger.Info("Error on creating new account", zap.Error(err)) + serverRespBytes = makeSignInFailureResp(SIGN_EABORT) + break + } + } else { break }