本文整理匯總了TypeScript中leancloud-jssdk.User類的典型用法代碼示例。如果您正苦於以下問題:TypeScript User類的具體用法?TypeScript User怎麽用?TypeScript User使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了User類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: code_user_signUp_with_username_and_password
function code_user_signUp_with_username_and_password(done){
let user : AV.User = new AV.User();// 新建 AVUser 對象實例
user.setUsername(newUsername());
user.setPassword('cat!@#123');
user.setEmail(newEmail());
user.signUp<AV.User>().then((loginedUser)=>{
chai.assert.isNotNull(loginedUser.id);
done();
},(error=>{
if(error) throw error;
}));
}
示例2: code_update_user_custom_properties
function code_update_user_custom_properties(done){
AV.User.logIn<AV.User>('Tom','cat!@#123').then((loginedUser)=>{
console.log(loginedUser);
loginedUser.set('age',25);
loginedUser.save();
},(error=>{
}));
}
示例3: code_user_logIn_with_mobilephonenumber_and_password
function code_user_logIn_with_mobilephonenumber_and_password(done){
AV.User.logInWithMobilePhone<AV.User>('Tom','cat!@#123').then((loginedUser)=>{
console.log(loginedUser);
chai.assert.isNotNull(loginedUser.id);
done();
},(error=>{
}));
}
示例4: code_current_user
function code_current_user(done){
let currentUser :AV.User = AV.User.current();
if(currentUser){
// 跳轉到首頁
} else {
//currentUser 為空時,可打開用戶注冊界麵…
}
}
示例5: code_get_user_properties
function code_get_user_properties(done){
AV.User.logIn<AV.User>('Tom','cat!@#123').then((loginedUser)=>{
console.log(loginedUser);
let username :string = loginedUser.getUsername();
let email :string = loginedUser.getEmail();
// 請注意,密碼不會明文存儲在雲端,因此密碼隻能重置,不能查看
},(error=>{
}));
}
示例6: create_post_set_acl_for_single_user
function create_post_set_acl_for_single_user(done){
let post : AV.Object = new AV.Object("Post");
post.set('title','大家好,我是新人');
let acl : AV.ACL = new AV.ACL();
acl.setPublicReadAccess(true);
acl.setWriteAccess(AV.User.current(),true);
post.setACL(acl);
post.save();
}
示例7: code_send_sms_code_for_loginOrSignup
function code_send_sms_code_for_loginOrSignup(done){
AV.Cloud.requestSmsCode('18612438929').then((success)=>{
if(success) {
done();
}
},(error)=>{
});
AV.User.logInWithMobilePhone('13577778888','cat!@#123').then((success)=>{
},(error)=>{
});
}
示例8: done
user1.signUp<AV.User>().then((loginedUser)=>{
let user2 : AV.User = new AV.User();// 新建 AVUser 對象實例
user2.setUsername(newUsername());
user2.setPassword('cat!@#123');
user2.setEmail(newEmail());
user2.setMobilePhoneNumber(mobile);
user2.signUp<AV.User>().then((loginedUser)=>{
},(error=>{
chai.assert.isNotNull(error);
done();
}));
},(error=>{
示例9: duplicate_users_with_same_mobilePhoneNumber
function duplicate_users_with_same_mobilePhoneNumber(done){
let user1 : AV.User = new AV.User();// 新建 AVUser 對象實例
user1.setUsername(newUsername());
user1.setPassword('cat!@#123');
user1.setEmail(newEmail());
let mobile = utils.newMobilePhoneNumber();
user1.setMobilePhoneNumber(mobile);
user1.signUp<AV.User>().then((loginedUser)=>{
let user2 : AV.User = new AV.User();// 新建 AVUser 對象實例
user2.setUsername(newUsername());
user2.setPassword('cat!@#123');
user2.setEmail(newEmail());
user2.setMobilePhoneNumber(mobile);
user2.signUp<AV.User>().then((loginedUser)=>{
},(error=>{
chai.assert.isNotNull(error);
done();
}));
},(error=>{
if(error) throw error;
}));
}
示例10: code_user_logIn_with_smsCode
function code_user_logIn_with_smsCode(done){
AV.User.logInWithMobilePhoneSmsCode('13577778888','238825').then((success)=>{
},(error)=>{
});
}