@@ -25,7 +25,7 @@ use crate::{
2525 model:: UserModel ,
2626 repository:: { CourseRepository , UserRepository } ,
2727 service:: { CourseService , PipelineService , StageService , StorageError , StorageService } ,
28- utils:: git,
28+ utils:: { crypto , git} ,
2929} ;
3030
3131#[ allow( dead_code) ]
@@ -60,6 +60,7 @@ impl RepoService {
6060 git_server_endpoint,
6161 git_committer_name,
6262 git_committer_email,
63+ auth_secret,
6364 ..
6465 } = & self . ctx . config ;
6566
@@ -94,7 +95,10 @@ impl RepoService {
9495 // ... and push to the remote repository
9596 let remote_url = format ! ( "{git_server_endpoint}/{owner}/{repo}.git" ) ;
9697 git:: add_remote ( workspace, "origin" , & remote_url) . await ?;
97- git:: push ( workspace, "origin" , "main" ) . await ?;
98+
99+ // Push with required credentials
100+ let password = crypto:: password ( git_committer_email, auth_secret) ;
101+ git:: push ( workspace, "origin" , "main" , TEMPLATE_OWNER , & password) . await ?;
98102
99103 debug ! ( "Successfully pushed template contents to repository: {}" , remote_url) ;
100104 Ok ( ( ) )
@@ -238,9 +242,9 @@ impl RepoService {
238242 Ok ( user) => Ok ( user) ,
239243 Err ( ClientError :: NotFound ) => {
240244 // Generate a password using email + auth_secret
241- let password = format ! ( "{}{}" , req . email , self . ctx. config. auth_secret) ;
242- let hashed_password = bcrypt :: hash ( password, bcrypt :: DEFAULT_COST ) ? ;
243- req. password = Some ( hashed_password ) ;
245+ let salt = & self . ctx . config . auth_secret ;
246+ let password = crypto :: password ( & req . email , salt ) ;
247+ req. password = Some ( password ) ;
244248
245249 Ok ( self . ctx . git . create_user ( req) . await ?)
246250 }
0 commit comments