blob: 0d7a7275c05e338d7c1111dee6152cd6367a9da1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/sh
change_userpass()
{
printf '%s\n' "$password" "$password" | ./run-quasselcore --change-userpass "$username"
}
quasseluser_reset_password()
{
username=$1
[ "$username" ]
password=$(tr -cd a-z </dev/urandom | head -c15)
[ "$password" ]
if [ -t 0 ]
then
err_out=$(mktemp)
trap 'rm -f "$err_out"' EXIT
if change_userpass >"$err_out" 2>&1
then
printf "User: %s\nPassword: %s\n" "$username" "$password"
else
cat "$err_out"
exit 1
fi
else
change_userpass
fi
}
set -e
[ $# -eq 1 ]
quasseluser_reset_password "$1"
|