fixed the account creation

This commit is contained in:
Jannover5000r 2025-11-14 09:10:35 +01:00
parent 74297067d8
commit c9a5dd2ff5
2 changed files with 20 additions and 14 deletions

View file

@ -12,6 +12,7 @@ import (
"io"
"os"
"os/signal"
"path/filepath"
"sync"
"syscall"
"time"
@ -108,6 +109,12 @@ func decrypt(encrypted string) (string, error) {
func saveAccount(userID, username, password string) error {
var accounts []Account
// Ensure the accounts directory exists
accountsDir := filepath.Dir(accountsFile)
if err := os.MkdirAll(accountsDir, 0755); err != nil {
return fmt.Errorf("failed to create accounts directory: %v", err)
}
// Load existing accounts if file exists
if data, err := os.ReadFile(accountsFile); err == nil && len(data) > 0 {
_ = json.Unmarshal(data, &accounts)

View file

@ -101,7 +101,6 @@ func init() {
}
func main() {
godotenv.Load(".env")
// Untis.Main() //starting API calls function| happens in schedule func
// Run()