Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_clicRegister(e) {
if (!this.state.buttonLogin) {
this._snackBarOpen('请在本页面填写「账号」与「密码」再点击注册啦~', 5000)
return
}
this.setState({ progressShow: true })
const mail = this.state.mail
const password = this.state.password
const user = new AV.User()
user.setUsername(mail)
user.setEmail(mail)
user.setPassword(password)
user.set('name', mail.split('@')[0])
user.signUp().then(loginedUser => {
this.props.history.push('/')
}).catch(error => {
this.setState({ progressShow: false })
if (error.code === 203)
return this._snackBarOpen('邮箱已被注册,是不是你忘记密码了?')
if (error.code === 125)
return this._snackBarOpen('电子邮箱地址无效,不要骗我')
return this._snackBarOpen('网络有些问题~')
})
}
// 切换找回密码与登陆界面
function commandFunc(args) {
var log = this.log;
var config = this.config;
if (args._.length !== 3) {
log.error('Too Few or Many Arguments.');
} else if (args._[0] === 'register' || args._[0] === 'r') {
var APP_ID = config.leancloud_counter_security.app_id;
var APP_KEY = config.leancloud_counter_security.app_key;
AV.init({
appId: APP_ID,
appKey: APP_KEY
});
var user = new AV.User();
user.setUsername(String(args._[1]));
user.setPassword(String(args._[2]));
user.signUp().then(function (loginedUser) {
log.info(loginedUser.getUsername() + ' is successfully signed up');
}, function (error) {
log.error(error);
});
} else {
log.error('Unknown Command.');
}
}
function commandFunc(args) {
var log = this.log;
var config = this.config;
if (args._.length !== 3) {
log.error('Too Few or Many Arguments.');
}
else if (args._[0] === 'register' || args._[0] === 'r') {
var APP_ID = config.leancloud_counter_security.app_id;
var APP_KEY = config.leancloud_counter_security.app_key;
AV.init({
appId: APP_ID,
appKey: APP_KEY
});
var user = new AV.User();
user.setUsername(String(args._[1]));
user.setPassword(String(args._[2]));
user.signUp().then(
(loginedUser) => { log.info(loginedUser.getUsername() + ' is successfully signed up'); },
(error) => { log.error(error); });
}
else {
log.error('Unknown Command.');
}
}
signUp: function () {
let user = new AV.User();
user.setUsername(this.formData.username);
user.setPassword(this.formData.password);
user.signUp().then((loginedUser) => {
this.currentUser = this.getCurrentUser()
}, (error) => {
alert('注册失败')
console.log(error)
});
},
login: function () {
signUp: function () {
let user = new AV.User();
user.setUsername(this.formData.username);
user.setPassword(this.formData.password);
user.signUp().then((loginedUser) => {
this.currentUser = this.getCurrentUser()
}, (error) => {
alert('注册失败')
});
},
login: function () {
export function signUp(payload) {
const { username, password, email } = payload
const avatar = getAvatar()
const nickname = getNickName()
const user = new AV.User()
user.setUsername(username)
user.setPassword(password)
user.setEmail(email)
return user.signUp().then(function(loginedUser) {
if (!loginedUser.get('userinfo')) {
const Userinfo = AV.Object.extend('UserInfo')
const userinfo = new Userinfo()
userinfo.set('nickname', nickname)
userinfo.set('contact', email)
userinfo.set('avatar', avatar)
userinfo.set('avatar', avatar)
userinfo.set('isPublic', true)
userinfo.set('show', 1)
userinfo.set('stick', 0)
userinfo.set('teamLimit', 1)
userinfo.set('groupOrderLimit', 1)
export function signUp(payload) {
const { username, password, email } = payload
const avatar = getAvatar()
const nickname = getNickName()
const user = new AV.User()
user.setUsername(username)
user.setPassword(password)
user.setEmail(email)
return user.signUp().then(function(loginedUser) {
if (!loginedUser.get('userinfo')) {
const Userinfo = AV.Object.extend('UserInfo')
const userinfo = new Userinfo()
userinfo.set('nickname', nickname)
userinfo.set('contact', email)
userinfo.set('avatar', avatar)
userinfo.set('avatar', avatar)
userinfo.set('isPublic', true)
userinfo.set('show', 1)
userinfo.set('stick', 0)
userinfo.set('teamLimit', 1)
userinfo.set('groupOrderLimit', 1)