-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
341 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.