-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from refactor-group/add_default_user
Add an initial Admin platform user
- Loading branch information
Showing
6 changed files
with
41 additions
and
3 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,22 @@ pub(crate) fn naive_date_parse_str(date_str: &str) -> Result<chrono::NaiveDate, | |
pub async fn seed_database(db: &DatabaseConnection) { | ||
let now = Utc::now(); | ||
|
||
let _admin_user: users::ActiveModel = users::ActiveModel { | ||
email: Set("[email protected]".to_owned()), | ||
first_name: Set(Some("Admin".to_owned())), | ||
last_name: Set(Some("User".to_owned())), | ||
display_name: Set(Some("Admin User".to_owned())), | ||
password: Set(generate_hash("dLxNxnjn&b!2sqkwFbb4s8jX")), | ||
github_username: Set(None), | ||
github_profile_url: Set(None), | ||
created_at: Set(now.into()), | ||
updated_at: Set(now.into()), | ||
..Default::default() | ||
} | ||
.save(db) | ||
.await | ||
.unwrap(); | ||
|
||
let jim_hodapp: users::ActiveModel = users::ActiveModel { | ||
email: Set("[email protected]".to_owned()), | ||
first_name: Set(Some("Jim".to_owned())), | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- IMPORTANT: to prevent a security issue, the following initial platform user's password | ||
-- needs to be changed after the postgres service container is created. | ||
-- The password hash params are password and a random salt value. | ||
INSERT INTO refactor_platform.users ( | ||
display_name, | ||
email, | ||
first_name, | ||
last_name, | ||
github_profile_url, | ||
github_username, | ||
password | ||
) | ||
VALUES ( | ||
'Admin', | ||
'[email protected]', | ||
'Admin', | ||
'User', | ||
'#', | ||
'', | ||
'$argon2id$v=19$m=19456,t=2,p=1$x4aqeh1xRaYsgeo0I5kB3A$gQz+ARyx7e6WjCNyNkOXNYFnLnc1eWqHXY+ASmJ7PDM' | ||
); |
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