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

35 lines
861 B

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