-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
0f6368a
commit 5aa8f9e
Showing
4 changed files
with
77 additions
and
54 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 |
---|---|---|
@@ -1,6 +1,11 @@ | ||
package data | ||
|
||
import "github.com/uug-ai/facial-access-control/api/models" | ||
import ( | ||
"log" | ||
|
||
"github.com/uug-ai/facial-access-control/api/models" | ||
"github.com/uug-ai/facial-access-control/api/utils" | ||
) | ||
|
||
var Users = []models.User{ | ||
{Id: 0, FirstName: "admin", LastName: "admin", Email: "[email protected]", Password: "admin", Role: "admin", Language: "en"}, | ||
|
@@ -23,5 +28,14 @@ var Locations = []models.Location{ | |
{Id: 4, Name: "Location 4", Address: "Address 4", Lat: 4.0, Lng: 4.0}, | ||
} | ||
|
||
|
||
// Initialize function to hash passwords | ||
func Initialize() { | ||
for i, user := range Users { | ||
hashedPassword, err := utils.Hash(user.Password) | ||
if err != nil { | ||
log.Fatalf("Error hashing password for user %s: %v", user.Email, err) | ||
} | ||
Users[i].Password = hashedPassword | ||
} | ||
} | ||
|
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
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
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