Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfc15736 authored by Felix Ableitner's avatar Felix Ableitner
Browse files

Use write() instead of writeln(), correct Nextcloud url

parent f9014b84
Loading
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -51,12 +51,9 @@ class MyHandler(BaseHTTPRequestHandler):
        ftp = ssh.open_sftp()
        temp_file_name = '/tmp/' + target_username + target_email.split('@')[0] + '-details'
        temp_file = ftp.file(temp_file_name, 'w')
        temp_file.writeln(target_email)
        temp_file.writeln(password)
        temp_file.writeln(password_confirm)
        temp_file.writeln(displayname)
        temp_file.writeln(email_quota)
        temp_file.write(f'{target_email}\n{password}\n{password_confirm}\n{displayname}\n{email_quota}')
        temp_file.flush()
        temp_file.close()
        ftp.close()
        stdin, stdout, stderr = ssh.exec_command('cat ' + temp_file_name + ' | /usr/local/bin/wrapper.sh')
        print(stdout.channel.recv_exit_status())
@@ -65,7 +62,7 @@ class MyHandler(BaseHTTPRequestHandler):

        # Edit nextcloud account, set quota and email
        auth = HTTPBasicAuth(os.environ['NEXTCLOUD_ADMIN_USER'], os.environ['NEXTCLOUD_ADMIN_PASSWORD'])
        url = 'http://localhost/ocs/v1.php/cloud/users/' + target_email
        url = 'http://nextcloud/ocs/v1.php/cloud/users/' + target_email
        headers = {'OCS-APIRequest': 'true'}
        r = requests.put(url, data={'key': 'email', 'value': fallback_email}, headers=headers, auth=auth)
        # TODO: check status code