Skip to content

Commit 7d0499c

Browse files
authored
Merge pull request #129 from ravigurram8/topic-release-11
csrf token updation
2 parents e1a1be1 + e9e5d79 commit 7d0499c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/create_rg_admin_user.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ instanceid=$(wget -q -O - http://169.254.169.254/latest/meta-data/instance-id)
4343
data="{\"username\":\"rgadmin\",\"first_name\":\"$firstname\",\"last_name\":\"$lastname\",\"email\":\"$emailid\",\"password\":\"RgAdmin@$instanceid\",\"level\":2}"
4444
#echo $data | jq -r
4545

46-
message=`curl --location --request POST "$baseurl/user/signup" --header "token: $token" --header "Content-Type: application/json" --data-raw $data | jq -r '.message'`
46+
curl -c cookies.txt -X GET -H "Content-Type: application/json" -H "token:$token" $baseurl/user/signup
47+
ctoken=`cat cookies.txt | awk '{if(NR==5) print $7}'`
48+
49+
message=`curl -b cookies.txt --location --request POST -H "X-CSRF-Token:$ctoken" --header "token:$token" --header "Content-Type: application/json" --data-raw $data $baseurl/user/signup | jq -r '.message'`
4750
if [ "$message" == "success" ]; then
4851
echo "Admin user created. You should receive an email to verify your email address. Please click on the link to change your password"
4952
else

0 commit comments

Comments
 (0)