本文整理匯總了TypeScript中meteor/accounts-base.Accounts.ui類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Accounts.ui類的具體用法?TypeScript Accounts.ui怎麽用?TypeScript Accounts.ui使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Accounts.ui類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
*/
Meteor.loginWithGithub({
requestPermissions: ['user', 'public_repo']
}, function (err: Meteor.Error) {
if (err)
Session.set('errorMessage', err.reason || 'Unknown error');
});
/**
* From Accounts, Accounts.ui.config section
*/
Accounts.ui.config({
requestPermissions: {
facebook: ['user_likes'],
github: ['user', 'repo']
},
requestOfflineToken: {
google: true
},
passwordSignupFields: 'USERNAME_AND_OPTIONAL_EMAIL'
});
/**
* From Accounts, Accounts.validateNewUser section
*/
Accounts.validateNewUser(function (user: { username: string }) {
if (user.username && user.username.length >= 3)
return true;
throw new Meteor.Error("403", "Username must have at least 3 characters");
});
// Validate username, without a specific error message.
Accounts.validateNewUser(function (user: { username: string }) {
示例2:
import { Accounts } from 'meteor/accounts-base';
Accounts.ui.config({
passwordSignupFields: 'EMAIL_ONLY',
});