From bcead2b9a2111a20cfd59cc879f1ff4081a88eb8 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Sun, 17 Nov 2019 15:30:53 +0100 Subject: [PATCH] Avatars removed from passwd and authd APIs. Will be re-added later through a more extensible mechanism. --- src/main.cr | 4 +--- src/passwd.cr | 20 +++----------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/main.cr b/src/main.cr index 8a02037..2396fab 100644 --- a/src/main.cr +++ b/src/main.cr @@ -149,9 +149,7 @@ IPC::Service.new "auth" do |event| Passwd.hash_password s end - avatar = request.avatar - - passwd.mod_user request.uid, password_hash: password_hash, avatar: avatar + passwd.mod_user request.uid, password_hash: password_hash client.send ResponseTypes::Ok, "" end diff --git a/src/passwd.cr b/src/passwd.cr index 7fc38ee..b6f4f00 100644 --- a/src/passwd.cr +++ b/src/passwd.cr @@ -174,7 +174,7 @@ class Passwd end # FIXME: Edit other important fields. - def mod_user(uid, password_hash : String? = nil, avatar : String? = nil) + def mod_user(uid, password_hash : String? = nil) new_passwd = passwd_as_array.map do |line| user = AuthD::User.new line @@ -183,10 +183,6 @@ class Passwd user.password_hash = hash end - avatar.try do |avatar| - user.avatar = avatar - end - user.to_csv else line.join(':') @@ -225,15 +221,6 @@ class AuthD::User @office_phone_number = gecos[2]? @home_phone_number = gecos[3]? @other_contact = gecos[4]? - - # CAUTION: NON-STANDARD EXTENSION - @avatar = gecos[5]?.try do |x| - if x != "" - Base64.decode_string x - else - nil - end - end end # FIXME: What about those two fields? Keep them, remove them? @@ -246,7 +233,7 @@ class AuthD::User end def gecos - unless @location || @office_phone_number || @home_phone_number || @other_contact || @avatar + unless @location || @office_phone_number || @home_phone_number || @other_contact if @full_name return @full_name else @@ -254,7 +241,6 @@ class AuthD::User end end - [@full_name || "", @location || "", @office_phone_number || "", @home_phone_number || "", @other_contact || "", Base64.strict_encode(@avatar || "")].join "," + [@full_name || "", @location || "", @office_phone_number || "", @home_phone_number || "", @other_contact || ""].join "," end end -