Telegram auth (wip)

This commit is contained in:
vjrj 2018-01-26 12:49:53 +01:00
parent 5fe60d20d3
commit 58c54e5b94
7 changed files with 92 additions and 9 deletions

View file

@ -1,6 +1,8 @@
/* eslint-disable import/no-absolute-path */
import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import { Accounts } from 'meteor/accounts-base';
import urlEnc from '/imports/modules/url-encode';
import editProfile from './edit-profile';
import rateLimit from '../../../modules/rate-limit';
@ -34,6 +36,13 @@ Meteor.methods({
'users.setLang': function userLang(lang) {
check(lang, validLangCode);
Meteor.users.update({ _id: this.userId }, { $set: { lang } });
},
'auth.getHash': async function getHash() {
const token = Accounts._generateStampedLoginToken();
const obj = Accounts._hashStampedToken(token);
// console.log(obj);
const sealed = await urlEnc.encrypt(obj);
return sealed;
}
});