1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-20 00:15:17 +00:00

Upgrade password system

This commit is contained in:
2021-02-13 10:52:04 +01:00
parent 6396271e9c
commit 36c096d415
4 changed files with 99 additions and 23 deletions

View File

@ -22,18 +22,17 @@ pub fn sha1_str(input: &str) -> String {
/// One-way user password crypt
///
/// This method will have to be replaced by a stronger algorithm once this implementation is
/// completely built.
/// This method is just transitional
///
/// It currently depends on PHP
///
/// ```
/// use comunic_server::utils::crypt_utils::crypt_pass;
/// use comunic_server::utils::crypt_utils::legacy_crypt_pass;
///
/// let res = crypt_pass("secret").unwrap();
/// let res = legacy_crypt_pass("secret").unwrap();
/// assert_eq!(res, "e5GUe5kdeUMGs");
/// ```
pub fn crypt_pass(pass: &str) -> ResultBoxError<String> {
pub fn legacy_crypt_pass(pass: &str) -> ResultBoxError<String> {
let hash = sha1_str(pass);
let result = std::process::Command::new("/usr/bin/php")