The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/2fa/client/TOTPSaml.js

32 lines
755 B

import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Utils2fa } from './lib/2fa';
import '../../meteor-accounts-saml/client/saml_client';
Meteor.loginWithSamlTokenAndTOTP = function(credentialToken, code, callback) {
Accounts.callLoginMethod({
methodArguments: [{
totp: {
login: {
saml: true,
credentialToken,
},
code,
},
}],
userCallback(error) {
if (error) {
Utils2fa.reportError(error, callback);
} else {
callback && callback();
}
},
});
};
const { loginWithSamlToken } = Meteor;
Meteor.loginWithSamlToken = function(options, callback) {
Utils2fa.overrideLoginMethod(loginWithSamlToken, [options], callback, Meteor.loginWithSamlTokenAndTOTP);
};