Support MSISDN login

This commit is contained in:
giomfo 2017-02-22 11:48:39 +01:00
parent 8a1280bc46
commit 5ac7bec2ee
2 changed files with 26 additions and 7 deletions

View file

@ -51,7 +51,7 @@
"auth_register" = "Register";
"auth_send_reset_email" = "Send Reset Email";
"auth_return_to_login" = "Return to login screen";
"auth_user_id_placeholder" = "Email or user name";
"auth_user_id_placeholder" = "Email, user name or phone number";
"auth_password_placeholder" = "Password";
"auth_new_password_placeholder" = "New password";
"auth_user_name_placeholder" = "User name";

View file

@ -299,18 +299,37 @@
{
parameters = @{
@"type": kMXLoginFlowTypePassword,
@"medium": @"email",
@"medium": kMX3PIDMediumEmail,
@"address": user,
@"password": self.passWordTextField.text
};
}
else
{
parameters = @{
@"type": kMXLoginFlowTypePassword,
@"user": user,
@"password": self.passWordTextField.text
};
// Retrieve the MCC (from the SIM card information)
// Note: the phone book country code is not defined yet
NSString *MCC = [MXKAppSettings standardAppSettings].phonebookCountryCode;
// Check whether the user login is a valid phone number.
NSString *msisdn = [MXKTools msisdnWithPhoneNumber:user andCountryCode:MCC];
if (msisdn)
{
parameters = @{
@"type": kMXLoginFlowTypePassword,
@"medium": kMX3PIDMediumMSISDN,
@"address": msisdn,
@"password": self.passWordTextField.text
};
}
else
{
parameters = @{
@"type": kMXLoginFlowTypePassword,
@"user": user,
@"password": self.passWordTextField.text
};
}
}
}
}