Avatars removed from passwd and authd APIs.

Will be re-added later through a more extensible mechanism.
ipc07
Luka Vandervelden 2019-11-17 15:30:53 +01:00
parent be72953127
commit bcead2b9a2
2 changed files with 4 additions and 20 deletions

View File

@ -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

View File

@ -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