Skip to content

Commit

Permalink
Release 3.3.0 (#41)
Browse files Browse the repository at this point in the history
* ci: use the main branch for official releases

* refactor: new container names and assets

* fix(docker-compose): wrong image tag runtipi/worker

* chore(docker-compose): add healthchecks for runtipi container

* chore: update deps

* fix(debug): check for file tipi-compose.yml instead of tipi-config.yml

* fix(debug): use new naming convention for debugging running containers

* feat: allow custom path for all runtipi folders

* chore: remove obsolete "version" from docker-compose

* ci: echo distinc id inside matrix

* refactor(api-request): improve error handling and error message

* refactor(main): use utility get_env_map

* fix(seed): throw an error if seed is not created instead of returning an empty string

* feat(reset-password): add dashboard link in printed result

* refactor: improve error handling

* refactor: update error handling and splitting

* test: is_major_bump

* Update reset password command to add an expiration timestamp

* Update reset_password.rs

Save current time instead of expiration

* refactor: proper error handling with timestamp calc

* chore: correct error wording

---------

Co-authored-by: hex-developer <77530549+hex-developer@users.noreply.github.com>
  • Loading branch information
nicotsx and sergi0g authored May 21, 2024
1 parent e6c0fb8 commit 2a45ea0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/commands/reset_password.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
use colored::Colorize;
use std::env;
use std::{fs::File, path::PathBuf};
use std::time::{SystemTime, UNIX_EPOCH};
use std::{fs::write, path::PathBuf};

use crate::utils::env::get_env_value;

pub fn run() {
let root_folder: PathBuf = env::current_dir().expect("Unable to get current directory");
let reset_password_request = File::create(root_folder.join("state").join("password-change-request"));
let timestamp = match SystemTime::now().duration_since(UNIX_EPOCH) {
Ok(duration) => duration.as_secs().to_string(),
Err(e) => {
println!("Error calculating timestamp: {}", e);
return;
}
};
let reset_password_request = write(root_folder.join("state").join("password-change-request"), timestamp);

match reset_password_request {
Ok(_) => {
Expand All @@ -22,7 +30,7 @@ pub fn run() {
}
Err(e) => {
println!(
"{} Unable to create password reset request. You can manually create an empty file at {} to initiate a password reset. Error: {}",
"{} Unable to create password reset request. You can manually create a file with `echo $(($(date +%s))) >> {}` to initiate a password reset. Error: {}",
"✗".red(),
root_folder
.join("state")
Expand Down

0 comments on commit 2a45ea0

Please sign in to comment.