forked from ProjectSegfault/publapi
put password in a file in user's home folder
This commit is contained in:
parent
5672b6a520
commit
44b5af735c
@ -39,9 +39,12 @@ func SignupPage(c *fiber.Ctx) error {
|
|||||||
bashscript := "#!/bin/bash \n" +
|
bashscript := "#!/bin/bash \n" +
|
||||||
"# Path: /var/publapi/users/" + username + ".sh\n" +
|
"# Path: /var/publapi/users/" + username + ".sh\n" +
|
||||||
"# This file is generated by publapi. Do not edit this file.\n" +
|
"# This file is generated by publapi. Do not edit this file.\n" +
|
||||||
"pass=\"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 64)\"" +
|
"pass=\"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 64)\"\n" +
|
||||||
"useradd -Um -s /bin/bash " + username + "\n" +
|
"useradd -Um -s /bin/bash " + username + "\n" +
|
||||||
"printf \"%s\\n%s\" \"${pass}\" \"${pass}\" | passwd " + username + "\n" +
|
"printf \"%s\\n%s\" \"${pass}\" \"${pass}\" | passwd " + username + "\n" +
|
||||||
|
"echo \"${pass}\" > /home/" + username + "/pass\n" +
|
||||||
|
"chmod 600 /home/" + username + "/pass\n" +
|
||||||
|
"chown " + username + ":" + username + " /home/" + username + "/pass\n" +
|
||||||
"echo \"" + username + "'s account has been created!\""
|
"echo \"" + username + "'s account has been created!\""
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user