From b51ed9a41d15bbe4b9ef4c0f61a6b774ab2eaf3e Mon Sep 17 00:00:00 2001 From: itsscb Date: Tue, 21 Nov 2023 23:57:39 +0100 Subject: [PATCH 1/3] rf/checks account_level given by bff --- frontend/app/lib/main.dart | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/frontend/app/lib/main.dart b/frontend/app/lib/main.dart index b48949c..03bf01c 100644 --- a/frontend/app/lib/main.dart +++ b/frontend/app/lib/main.dart @@ -88,16 +88,25 @@ class _DigitalerFriedenState extends State { accountLevel = await _storageService.accountLevel; accessToken = await _storageService.accessToken; verified = await _storageService.verified; - if (accountLevel! > 1) { - authenticated = await AuthService.authenticateWithBiometrics(); - } - if (authenticated && accountLevel != null && accountLevel! > 3) { + + if (accessToken != null) { account = await _vm.account; } - if (account != null && !verified && account!.emailVerified) { - await _storageService.setVerified(account!.emailVerified); - verified = account!.emailVerified; + if (account != null) { + if (verified != account!.emailVerified) { + verified = account!.emailVerified; + _storageService.setVerified(verified); + } + + if (accountLevel == null || account!.accountLevel > accountLevel!) { + accountLevel = account!.accountLevel; + _storageService.setAccountLevel(account!.accountLevel); + } + } + + if (accountLevel! > 1) { + authenticated = await AuthService.authenticateWithBiometrics(); } print( From fab35397cc747d0bc073689317a67bc2db1af8bd Mon Sep 17 00:00:00 2001 From: itsscb Date: Wed, 22 Nov 2023 14:55:57 +0100 Subject: [PATCH 2/3] fix/reapplies some changes that were magically lost --- bff/app.env | 1 + bff/gapi/rpc_create_account.go | 2 +- bff/gapi/rpc_resend_verification.go | 2 +- bff/gapi/rpc_update_account.go | 2 +- bff/main.go | 2 +- bff/util/config.go | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bff/app.env b/bff/app.env index 53e859b..ca08b97 100644 --- a/bff/app.env +++ b/bff/app.env @@ -7,6 +7,7 @@ LOG_OUTPUT=text ACCESS_TOKEN_DURATION=15m MIGRATION_URL=file://db/migration MIGRATION_RETRIES=5 +SWAGGER=true REFRESH_TOKEN_DURATION=24h TOKEN_PRIVATEKEY_HEX=099c0b96725b99e95719c92aec580809ac58fc14be2105ed2656f1f6c464593d8cacd6c7bed924b9cf207ab3cff1c59be4e5865260c4dafa29699244bd4ea2de SMTP_ADDRESS=smtp.gmail.com:587 diff --git a/bff/gapi/rpc_create_account.go b/bff/gapi/rpc_create_account.go index a2fc6c1..81c0dc2 100644 --- a/bff/gapi/rpc_create_account.go +++ b/bff/gapi/rpc_create_account.go @@ -32,7 +32,7 @@ func (server *Server) CreateAccount(ctx context.Context, req *pb.CreateAccountRe Email: req.GetEmail(), }, AfterCreate: func(a db.Account) error { - return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", req.GetEmail(), a.ID, a.SecretKey.String), []string{req.GetEmail()}, nil, nil, nil) + return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", req.GetEmail(), a.ID, a.SecretKey.String), []string{req.GetEmail()}, nil, nil, nil) }, } diff --git a/bff/gapi/rpc_resend_verification.go b/bff/gapi/rpc_resend_verification.go index 0426f1a..f3803c2 100644 --- a/bff/gapi/rpc_resend_verification.go +++ b/bff/gapi/rpc_resend_verification.go @@ -50,7 +50,7 @@ func (server *Server) ResendVerification(ctx context.Context, req *pb.ResendVeri ID: req.GetAccountId(), }, AfterCreate: func(a db.Account) error { - return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", account.Email, a.ID, a.SecretKey.String), []string{account.Email}, nil, nil, nil) + return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", account.Email, a.ID, a.SecretKey.String), []string{account.Email}, nil, nil, nil) }, } diff --git a/bff/gapi/rpc_update_account.go b/bff/gapi/rpc_update_account.go index 3365f80..b67f870 100644 --- a/bff/gapi/rpc_update_account.go +++ b/bff/gapi/rpc_update_account.go @@ -69,7 +69,7 @@ func (server *Server) UpdateAccount(ctx context.Context, req *pb.UpdateAccountRe } } else { arg.AfterUpdate = func(a db.Account) error { - return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", req.GetEmail(), a.ID, a.SecretKey.String), []string{req.GetEmail()}, nil, nil, nil) + return server.mailSender.SendEmail("Verify your E-Mail Address", fmt.Sprintf("Hello %s,

please verify your E-Mail Addres by clicking on the following link:
Verification Link


Your Team of DF", req.GetEmail(), a.ID, a.SecretKey.String), []string{req.GetEmail()}, nil, nil, nil) } } } diff --git a/bff/main.go b/bff/main.go index 85887e3..cf8dc83 100644 --- a/bff/main.go +++ b/bff/main.go @@ -46,7 +46,7 @@ func main() { store := db.NewStore(conn) - if config.Environment == "development" { + if config.Swagger { subDir, err := fs.Sub(swaggerFiles, "doc/swagger") if err != nil { log.Fatalf("could not import swagger files") diff --git a/bff/util/config.go b/bff/util/config.go index 69a1168..b37be6d 100644 --- a/bff/util/config.go +++ b/bff/util/config.go @@ -19,6 +19,7 @@ type Config struct { SMTPPassword string `mapstructure:"SMTP_PASSWORD"` SMTPMail string `mapstructure:"SMTP_MAIL"` MigrationRetries int `mapstructure:"MIGRATION_RETRIES"` + Swagger bool `mapstructure:"SWAGGER"` AccessTokenDuration time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"` RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"` } From 841b8d41582946ae8507c2df49880c560658dd02 Mon Sep 17 00:00:00 2001 From: itsscb Date: Fri, 1 Dec 2023 00:21:10 +0100 Subject: [PATCH 3/3] ft/adds jenkinsfile --- Jenkinsfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3da93e2 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,11 @@ +pipeline { + agent any + + stages { + stage('Build') { + steps { + echo 'Test Building..' + } + } + } +} \ No newline at end of file