Skip to content

Commit

Permalink
refactoring connector
Browse files Browse the repository at this point in the history
  • Loading branch information
zakhaev26 committed Jan 13, 2024
1 parent 70aaa11 commit 84adee1
Show file tree
Hide file tree
Showing 13 changed files with 341 additions and 350 deletions.
34 changes: 34 additions & 0 deletions connector/controllers/connector.controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package connector_controller

import (
"encoding/json"
"net/http"

database "github.com/p-society/gCSB/connector/db"
helper "github.com/p-society/gCSB/connector/helpers"
verificationModel "github.com/p-society/gCSB/connector/model"
)

func Verify(w http.ResponseWriter, r *http.Request) {

var message verificationModel.VerificationModel
json.NewDecoder(r.Body).Decode(&message)
message.OTP, message.OTPExpiration = helper.GenerateOTP()
message.Password = helper.Secure_Passwords(message.Password)
message.IsVerified = false

VerificationCollection := database.Database.Collection("Verification")

_, err := VerificationCollection.InsertOne(r.Context(), message)

if err != nil {
json.NewEncoder(w).Encode(err)
return
}

_ = helper.SendMail("content","test","[email protected]")

json.NewEncoder(w).Encode(map[string]interface{}{
"message": "Please Verify Yourself by submitting the OTP sent in your Email Address",
})
}
218 changes: 0 additions & 218 deletions connector/controllers/playerRegistration.controller.go

This file was deleted.

Loading

0 comments on commit 84adee1

Please sign in to comment.