Subversion Repositories ALCASAR

Rev

Rev 2564 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2564 Rev 2606
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-profil.sh 2564 2018-07-07 21:03:32Z lucas.echard $
2
# $Id: alcasar-profil.sh 2606 2018-08-20 00:11:49Z tom.houdayer $
3
 
3
 
4
# alcasar-profil.sh
4
# alcasar-profil.sh
5
# by Richard REY
5
# by Richard REY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 31... Line 31...
31
	else
31
	else
32
		echo "Adding user $username in realm $REALM"
32
		echo "Adding user $username in realm $REALM"
33
	fi
33
	fi
34
 
34
 
35
	equal=0
35
	equal=0
36
 
-
 
37
	while [ $equal -eq 0 ]; do
36
	while [ $equal -eq 0 ]; do
38
		echo -n "New password: "
37
		echo -n "New password: "
39
		read -s pass_1
38
		read -s pass_1
40
		echo
39
		echo
41
		echo -n "Confirm the new password: "
40
		echo -n "Confirm the new password: "
42
		read -s pass_2
41
		read -s pass_2
43
		echo
42
		echo
44
 
43
 
45
		if [ "$pass_1" != "$pass_2" ]; then
44
		if [ -n "$pass_1" ] && [ "$pass_1" != "$pass_2" ]; then
46
			echo -e "\nThe passwords don't match.\n"
45
			echo -e "\nThe passwords don't match.\n"
47
		else
46
		else
48
			equal=1
47
			equal=1
49
		fi
48
		fi
50
	done
49
	done
Line 132... Line 131...
132
			then
131
			then
133
				echo -n "Choisissez un profil ($ALL_PROFILS) : "
132
				echo -n "Choisissez un profil ($ALL_PROFILS) : "
134
			else
133
			else
135
				echo -n "Select a profile ($ALL_PROFILS) : "
134
				echo -n "Select a profile ($ALL_PROFILS) : "
136
			fi
135
			fi
-
 
136
			profil=''
-
 
137
			while [ -z "$profil" ]; do
137
			read profil
138
				read profil
-
 
139
			done
138
		else
140
		else
139
			profil="$2"
141
			profil="$2"
140
		fi
142
		fi
141
 
143
 
142
		if ! echo $ALL_PROFILS | grep -qw $profil
144
		if ! echo $ALL_PROFILS | grep -qw $profil
Line 154... Line 156...
154
		then
156
		then
155
			echo -n "Entrez le nom du compte à créer (profil '$profil') : "
157
			echo -n "Entrez le nom du compte à créer (profil '$profil') : "
156
		else
158
		else
157
			echo "Enter the name of the account to create (profile '$profil') : "
159
			echo "Enter the name of the account to create (profile '$profil') : "
158
		fi
160
		fi
-
 
161
		account=''
-
 
162
		while [ -z "$account" ]; do
159
		read account
163
			read account
-
 
164
		done
-
 
165
		# TODO : add check
160
		# on teste s'il n'existe pas déjà
166
		# on teste s'il n'existe pas déjà
161
		for i in $ALL_PROFILS
167
		for i in $ALL_PROFILS
162
		do
168
		do
163
			tmp_account=`cat $DIR_KEY/key_only_$i | cut -d':' -f1`
169
			tmp_account=`cat $DIR_KEY/key_only_$i | cut -d':' -f1`
164
			for j in $tmp_account
170
			for j in $tmp_account
Line 185... Line 191...
185
		then
191
		then
186
			echo -n "entrez le nom du compte à supprimer : "
192
			echo -n "entrez le nom du compte à supprimer : "
187
		else
193
		else
188
			echo -n "enter the name of the account to remove : "
194
			echo -n "enter the name of the account to remove : "
189
		fi
195
		fi
190
		read account
196
		account=''
191
		for i in $ALL_PROFILS
197
		while [ -z "$account" ]; do
-
 
198
			read account
192
			do
199
		done
-
 
200
		for i in $ALL_PROFILS; do
193
			$SED "/^$account:/d" $DIR_KEY/key_only_$i
201
			$SED "/^$account:/d" $DIR_KEY/key_only_$i
194
			done
202
		done
195
		concat
203
		concat
196
		list
204
		list
197
		;;
205
		;;
198
	--pass|-p)
206
	--pass|-p)
199
		# changement du mot de passe d'un compte
207
		# changement du mot de passe d'un compte