mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-08-11 09:53:19 +00:00
fix(passwordRecoveyr): get the domain from the user mail
This commit is contained in:
+14
-10
@@ -1316,7 +1316,7 @@ static const NSString *kJwtKey = @"jwt";
|
||||
*/
|
||||
- (WOResponse *) passwordRecoveryEmailAction
|
||||
{
|
||||
NSString *username, *domain, *mode, *uid, *mailDomain, *fromEmail, *toEmail, *jwtToken, *url, *mailContent;
|
||||
NSString *username, *domain, *mode, *uid, *mailDomain, *fromEmail, *toEmail, *jwtToken, *url, *mailContent, *email;
|
||||
NSDictionary *message, *info;
|
||||
WORequest *request;
|
||||
SOGoUserManager *um;
|
||||
@@ -1333,7 +1333,6 @@ static const NSString *kJwtKey = @"jwt";
|
||||
message = [[request contentAsString] objectFromJSONString];
|
||||
username = [message objectForKey: @"userName"];
|
||||
domain = [message objectForKey: @"domain"];
|
||||
mailDomain = [message objectForKey: @"mailDomain"];
|
||||
mode = [message objectForKey: @"mode"];
|
||||
um = [SOGoUserManager sharedUserManager];
|
||||
jwtToken = [request formValueForKey:@"token"];
|
||||
@@ -1345,14 +1344,6 @@ static const NSString *kJwtKey = @"jwt";
|
||||
ownerUser = [SOGoUser userWithLogin: username];
|
||||
dd = [ownerUser domainDefaults];
|
||||
|
||||
// Email recovery
|
||||
|
||||
// Create email from
|
||||
if (mailDomain) {
|
||||
fromEmail = [NSString stringWithFormat:@"noreply@%@", mailDomain];
|
||||
} else {
|
||||
fromEmail = [dd passwordRecoveryFrom];
|
||||
}
|
||||
|
||||
// Get password recovery email
|
||||
info = [um contactInfosForUserWithUIDorEmail: username];
|
||||
@@ -1361,6 +1352,19 @@ static const NSString *kJwtKey = @"jwt";
|
||||
inDomain: domain];
|
||||
toEmail = [userDefaults passwordRecoverySecondaryEmail];
|
||||
|
||||
//get fromEmail domain
|
||||
email = [info objectForKey: @"c_email"];
|
||||
// Create email from
|
||||
mailDomain = [email mailDomain];
|
||||
if (mailDomain) {
|
||||
fromEmail = [NSString stringWithFormat:@"noreply@%@", mailDomain];
|
||||
} else {
|
||||
fromEmail = [dd passwordRecoveryFrom];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (toEmail) {
|
||||
// Generate token
|
||||
jwtToken = [um generateAndSavePasswordRecoveryTokenWithUid: uid username: username domain: domain];
|
||||
|
||||
Reference in New Issue
Block a user