diff --git a/src/App/Messages/AuthenticationDaemon.purs b/src/App/Messages/AuthenticationDaemon.purs index 2b33134..f2bf089 100644 --- a/src/App/Messages/AuthenticationDaemon.purs +++ b/src/App/Messages/AuthenticationDaemon.purs @@ -30,9 +30,6 @@ import App.IPC as IPC Possible requests: - 9 type CheckPermission = { shared_key :: Maybe String, token :: Maybe String, user :: Int | String, service :: String, resource :: String } - 10 type SetPermission = { shared_key :: String, user :: Int | String, service :: String, resource :: String, permission :: PermissionLevel.PermissionLevel } - - 11 type PasswordRecovery = { user :: Int | String, password_renew_key :: String, new_password :: String } - - 12 type AskPasswordRecovery = { user :: Int | String, email :: Email.Email } - - 13 type SearchUser = { user :: String } - 14 type EditProfile = { token :: String, new_profile :: Hash(String, JSON::Any) } - 15 type EditProfileContent = { token :: Maybe String, shared_key :: Maybe String, user :: Int | String | Nil, new_profile :: Hash(String, JSON::Any) } - 16 type EditContacts = { token :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone } @@ -69,6 +66,9 @@ type GetUserByCredentials = { login :: String, password :: String } type Register = { login :: String, password :: String, email :: Maybe Email.Email, phone :: Maybe Phone.Phone } -- profile :: Maybe Hash(String, JSON::Any) type UpdatePassword = { login :: String, old_password :: String, new_password :: String } type ListUsers = { token :: Maybe String, key :: Maybe String } +type PasswordRecovery = { user :: String, password_renew_key :: String, new_password :: String } +type AskPasswordRecovery = { user :: String, email :: Email.Email } +type SearchUser = { user :: String } type GetContacts = { token :: String } -- Related JSON codecs. @@ -99,6 +99,12 @@ codecUpdatePassword = CA.object "UpdatePassword" (CAR.record { login: CA.string , new_password: CA.string }) codecListUsers ∷ CA.JsonCodec ListUsers codecListUsers = CA.object "ListUsers" (CAR.record { token: CAR.optional CA.string, key: CAR.optional CA.string }) +codecPasswordRecovery ∷ CA.JsonCodec PasswordRecovery +codecPasswordRecovery = CA.object "PasswordRecovery" (CAR.record { user: CA.string, password_renew_key: CA.string, new_password: CA.string }) +codecAskPasswordRecovery ∷ CA.JsonCodec AskPasswordRecovery +codecAskPasswordRecovery = CA.object "AskPasswordRecovery" (CAR.record { user: CA.string, email: Email.codec }) +codecSearchUser ∷ CA.JsonCodec SearchUser +codecSearchUser = CA.object "SearchUser" (CAR.record { user: CA.string }) codecGetContacts ∷ CA.JsonCodec GetContacts codecGetContacts = CA.object "GetContacts" (CAR.record { token: CA.string }) @@ -150,9 +156,9 @@ data RequestMessage | MkListUsers ListUsers -- 8 --| MkCheckPermission CheckPermission -- 9 --| MkSetPermission SetPermission -- 10 - --| MkPasswordRecovery PasswordRecovery -- 11 - --| MkAskPasswordRecovery AskPasswordRecovery -- 12 - --| MkSearchUser SearchUser -- 13 + | MkPasswordRecovery PasswordRecovery -- 11 + | MkAskPasswordRecovery AskPasswordRecovery -- 12 + | MkSearchUser SearchUser -- 13 --| MkEditProfile EditProfile -- 14 --| MkEditProfileContent EditProfileContent -- 15 --| MkEditContacts EditContacts -- 16 @@ -190,9 +196,9 @@ encode m = case m of (MkListUsers request) -> get_tuple 8 codecListUsers request -- 9 MkCheckPermission -- 10 MkSetPermission - -- 11 MkPasswordRecovery - -- 12 MkAskPasswordRecovery - -- 13 MkSearchUser + (MkPasswordRecovery request) -> get_tuple 11 codecPasswordRecovery request + (MkAskPasswordRecovery request) -> get_tuple 12 codecAskPasswordRecovery request + (MkSearchUser request) -> get_tuple 13 codecSearchUser request -- 14 MkEditProfile -- 15 MkEditProfileContent -- 16 MkEditContacts