mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
Support MSISDN login
This commit is contained in:
parent
8a1280bc46
commit
5ac7bec2ee
2 changed files with 26 additions and 7 deletions
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue