1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00
baikal_ynh/scripts/actions/reset_admin_password
Éric Gaspar 24580dc48c
0.9.2 (#64) (#66)
* 0.9.2 (#64)

* 0.9.2

* Auto-update README

* Update upgrade

* Remove patch

* Update install

* Update install

* Fix

* Auto-update README

* Fix

* Revert "Remove patch"

This reverts commit 760cfff3b3.

* Delete app-add-ldap-auth.patch

* Fix

* Create app-add-ldap-auth.patch

* Update app-add-ldap-auth.patch

* Update upgrade

* Fix

* Fix

* Update install

* Update upgrade

* Update upgrade

* Update upgrade

* Update manifest.json

* Update upgrade

* Update upgrade

* Update baikal.yaml

* Update baikal.yaml

* Update manifest.json

* Update change_url

* Update baikal.yaml

* Update nginx.conf

* Update upgrade

* Update upgrade

* Update upgrade

* Update upgrade

* Update scripts/_common.sh

Co-authored-by: Kayou <pierre@kayou.io>

* Update nginx.conf

* Update install

* Update upgrade

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Kayou <pierre@kayou.io>

* Update nginx.conf

* deskey -> encrypt_key

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Kayou <pierre@kayou.io>
2022-05-27 23:04:44 +02:00

57 lines
1.9 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
# Get password
password=${YNH_ACTION_PASSWORD}
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
password_hash_old=$(ynh_app_setting_get --app=$app --key=password_hash)
password_hash=$(echo -n admin:BaikalDAV:$password | sha256sum | cut -d ' ' -f 1)
if [ $password_hash == $password_hash_old ]
then
ynh_die "This is the same password." 0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# CHANGE THE PASSWORD
#=================================================
ynh_script_progression --message="Changing the password..." --weight=1
bk_conf="${final_path}/config/baikal.yaml"
ynh_backup_if_checksum_is_different --file="$final_path/config/baikal.yaml"
ynh_replace_string --match_string="${password_hash_old}" --replace_string="${password_hash}" --target_file="$final_path/config/baikal.yaml"
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
ynh_store_file_checksum --file="$final_path/config/baikal.yaml"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last