|
7106 | 7106 | return user.logIn(options); |
7107 | 7107 | }, |
7108 | 7108 |
|
| 7109 | + /** |
| 7110 | + * Logs in a user with a mobile phone number and sms code sent by |
| 7111 | + * AV.User.requestLoginSmsCode.On success, this |
| 7112 | + * saves the session to disk, so you can retrieve the currently logged in |
| 7113 | + * user using <code>current</code>. |
| 7114 | + * |
| 7115 | + * <p>Calls options.success or options.error on completion.</p> |
| 7116 | + * |
| 7117 | + * @param {String} mobilePhone The user's mobilePhoneNumber |
| 7118 | + * @param {String} smsCode The sms code sent by AV.User.requestLoginSmsCode |
| 7119 | + * @param {Object} options A Backbone-style options object. |
| 7120 | + * @return {AV.Promise} A promise that is fulfilled with the user when |
| 7121 | + * the login completes. |
| 7122 | + * @see AV.User#logIn |
| 7123 | + */ |
7109 | 7124 | logInWithMobilePhoneSmsCode: function(mobilePhone, smsCode, options){ |
7110 | 7125 | var user = AV.Object._create("_User"); |
7111 | 7126 | user._finishFetch({ mobilePhoneNumber: mobilePhone, smsCode: smsCode }); |
7112 | 7127 | return user.logIn(options); |
7113 | 7128 | }, |
7114 | 7129 |
|
| 7130 | + /** |
| 7131 | + * Logs in a user with a mobile phone number and password. On success, this |
| 7132 | + * saves the session to disk, so you can retrieve the currently logged in |
| 7133 | + * user using <code>current</code>. |
| 7134 | + * |
| 7135 | + * <p>Calls options.success or options.error on completion.</p> |
| 7136 | + * |
| 7137 | + * @param {String} mobilePhone The user's mobilePhoneNumber |
| 7138 | + * @param {String} password The password to log in with. |
| 7139 | + * @param {Object} options A Backbone-style options object. |
| 7140 | + * @return {AV.Promise} A promise that is fulfilled with the user when |
| 7141 | + * the login completes. |
| 7142 | + * @see AV.User#logIn |
| 7143 | + */ |
7115 | 7144 | logInWithMobilePhone: function(mobilePhone, password, options){ |
7116 | 7145 | var user = AV.Object._create("_User"); |
7117 | 7146 | user._finishFetch({ mobilePhoneNumber: mobilePhone, password: password }); |
|
7182 | 7211 | return request._thenRunCallbacks(options); |
7183 | 7212 | }, |
7184 | 7213 |
|
| 7214 | + /** |
| 7215 | + * Requests a verify email to be sent to the specified email address |
| 7216 | + * associated with the user account. This email allows the user to securely |
| 7217 | + * verify their email address on the AV site. |
| 7218 | + * |
| 7219 | + * <p>Calls options.success or options.error on completion.</p> |
| 7220 | + * |
| 7221 | + * @param {String} email The email address associated with the user that |
| 7222 | + * doesn't verify their email address. |
| 7223 | + * @param {Object} options A Backbone-style options object. |
| 7224 | + */ |
7185 | 7225 | requestEmailVerfiyInBackground: function(email, options) { |
7186 | 7226 | var json = { email: email }; |
7187 | 7227 | var request = AV._request("requestEmailVerify", null, null, "POST", |
7188 | 7228 | json); |
7189 | 7229 | return request._thenRunCallbacks(options); |
7190 | 7230 | }, |
7191 | 7231 |
|
| 7232 | + /** |
| 7233 | + * Requests a verify sms code to be sent to the specified mobile phone |
| 7234 | + * number associated with the user account. This sms code allows the user to |
| 7235 | + * verify their mobile phone number by calling AV.User.verifyMobilePhone |
| 7236 | + * |
| 7237 | + * <p>Calls options.success or options.error on completion.</p> |
| 7238 | + * |
| 7239 | + * @param {String} mobilePhone The mobile phone number associated with the |
| 7240 | + * user that doesn't verify their mobile phone number. |
| 7241 | + * @param {Object} options A Backbone-style options object. |
| 7242 | + */ |
7192 | 7243 | requestMobilePhoneVerify: function(mobilePhone, options){ |
7193 | 7244 | var json = { mobilePhoneNumber: mobilePhone }; |
7194 | 7245 | var request = AV._request("requestMobilePhoneVerify", null, null, "POST", |
7195 | 7246 | json); |
7196 | 7247 | return request._thenRunCallbacks(options); |
7197 | 7248 | }, |
7198 | 7249 |
|
| 7250 | + /** |
| 7251 | + * Makes a call to verify sms code that sent by AV.User.Cloud.requestSmsCode |
| 7252 | + * If verify successfully,the user mobilePhoneVerified attribute will be true. |
| 7253 | + * @param {String} code The sms code sent by AV.User.Cloud.requestSmsCode |
| 7254 | + * @param {Object} options A Backbone-style options object |
| 7255 | + * @return {AV.Promise} A promise that will be resolved with the result |
| 7256 | + * of the function. |
| 7257 | + */ |
7199 | 7258 | verifyMobilePhone: function(code, options){ |
7200 | 7259 | var request = AV._request("verifyMobilePhone", null, code, "POST", |
7201 | 7260 | json); |
7202 | 7261 | return request._thenRunCallbacks(options); |
7203 | 7262 | }, |
7204 | 7263 |
|
| 7264 | + /** |
| 7265 | + * Requests a logIn sms code to be sent to the specified mobile phone |
| 7266 | + * number associated with the user account. This sms code allows the user to |
| 7267 | + * login by AV.User.logInWithMobilePhoneSmsCode function. |
| 7268 | + * |
| 7269 | + * <p>Calls options.success or options.error on completion.</p> |
| 7270 | + * |
| 7271 | + * @param {String} mobilePhone The mobile phone number associated with the |
| 7272 | + * user that want to login by AV.User.logInWithMobilePhoneSmsCode |
| 7273 | + * @param {Object} options A Backbone-style options object. |
| 7274 | + */ |
7205 | 7275 | requestLoginSmsCode: function(mobilePhone, options){ |
7206 | 7276 | var json = { mobilePhoneNumber: mobilePhone }; |
7207 | 7277 | var request = AV._request("requestLoginSmsCode", null, null, "POST", |
|
8727 | 8797 | })._thenRunCallbacks(options); |
8728 | 8798 | }, |
8729 | 8799 |
|
| 8800 | + /** |
| 8801 | + * Makes a call to request a sms code for operation verification. |
| 8802 | + * @param {Object} data The mobile phone number string or a JSON object contains mobilePhoneNumber,op,ttl,name etc. |
| 8803 | + * @param {Object} options A Backbone-style options object |
| 8804 | + * @return {AV.Promise} A promise that will be resolved with the result |
| 8805 | + * of the function. |
| 8806 | + */ |
8730 | 8807 | requestSmsCode: function(data, options){ |
8731 | 8808 | if(typeof data === 'string') |
8732 | 8809 | data = { mobilePhoneNumber: data }; |
|
8737 | 8814 | return request._thenRunCallbacks(options); |
8738 | 8815 | }, |
8739 | 8816 |
|
| 8817 | + /** |
| 8818 | + * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode |
| 8819 | + * @param {String} code The sms code sent by AV.Cloud.requestSmsCode |
| 8820 | + * @param {Object} options A Backbone-style options object |
| 8821 | + * @return {AV.Promise} A promise that will be resolved with the result |
| 8822 | + * of the function. |
| 8823 | + */ |
8740 | 8824 | verifySmsCode: function(code, options){ |
8741 | 8825 | if(!code) |
8742 | 8826 | throw "Missing sms code."; |
|
0 commit comments