Skip to content

Commit

Permalink
Set Source and Destination validation requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
xeome committed Oct 17, 2023
1 parent 30be547 commit 9528524
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions controller/validation_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ func HandleValidate(ctx *gin.Context) {
submitsync := ctx.PostForm("submit_sync")

var Server, Account, Password string
var Source bool

if sourceCreds != "" {
Server = ctx.PostForm("source_server")
Account = ctx.PostForm("source_account")
Password = ctx.PostForm("source_password")
Source = true
}

if destCreds != "" {
Server = ctx.PostForm("destination_server")
Account = ctx.PostForm("destination_account")
Password = ctx.PostForm("destination_password")
Source = false
}

if destCreds == "" && sourceCreds == "" && submitsync != "" {
Expand All @@ -35,6 +38,7 @@ func HandleValidate(ctx *gin.Context) {
Server: Server,
Account: Account,
Password: Password,
Source: Source,
}

log.Infof("Validating credentials for: %s", creds.Account)
Expand Down
1 change: 1 addition & 0 deletions internal/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Credentials struct {
Server string
Account string
Password string
Source bool
}

var queue *list.List
Expand Down
4 changes: 3 additions & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ <h2 class="text-2xl font-semibold">User queue</h2>
update_source_status(result) {
this.source_validated = result
},

update_destination_status(result) {
this.destination_validated = result
},
}))
})

Expand Down
2 changes: 1 addition & 1 deletion templates/success.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div x-data="update_source_status(true)"
<div x-data="{{if .Source}}update_source_status(true) {{else}} update_destination_status(true) {{end}}"
class="alert alert-success max-w-sm absolute top-0 right-0 mt-4 mr-4 cursor-pointer" id="error-notification">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd"
Expand Down

0 comments on commit 9528524

Please sign in to comment.