def __do_signup(request, _userinfo): _state = { 'success': False, 'message': '', } # check username exist if (_userinfo['username'] == ''): _state['success'] = False _state['message'] = _('"Username" have not inputed.') return _state if (_userinfo['password'] == ''): _state['success'] = False _state['message'] = _('"Password" have not inputed.') return _state if (_userinfo['realname'] == ''): _state['success'] = False _state['message'] = _('"Real Name" have not inputed.') return _state if (_userinfo['email'] == ''): _state['success'] = False _state['message'] = _('"Email" have not inputed.') return _state # check username exist if (__check_username_exist(_userinfo['username'])): _state['success'] = False _state['message'] = _('"Username" have existed.') return _state # check password & confirm password if (_userinfo['password'] != _userinfo['confirm']): _state['success'] = False _state['message'] = _('"Confirm Password" have not match.') return _state _user = User( username=_userinfo['username'], realname=_userinfo['realname'], password=_userinfo['password'], email=_userinfo['email'], #area = Area.objects.get(id=1) ) #try: _user.save() _state['success'] = True _state['message'] = _('Successed.') #except: #_state['success'] = False #_state['message'] = '程序异常,注册失败.' # send regist success mail mailer.send_regist_success_mail(_userinfo) return _state
def __do_signup(request,_userinfo): _state = { 'success' : False, 'message' : '', } # check username exist if(_userinfo['username'] == ''): _state['success'] = False _state['message'] = '用户名未输入.' return _state if(_userinfo['password'] == ''): _state['success'] = False _state['message'] = '密码未输入.' return _state if(_userinfo['realname'] == ''): _state['success'] = False _state['message'] = '姓名未输入.' return _state if(_userinfo['email'] == ''): _state['success'] = False _state['message'] = 'email未输入.' return _state # check username exist if(__check_username_exist(_userinfo['username'])): _state['success'] = False _state['message'] = '用户名已存在.' return _state # check password & confirm password if(_userinfo['password'] != _userinfo['confirm']): _state['success'] = False _state['message'] = '确认密码不正确.' return _state _user = User( username = _userinfo['username'], realname = _userinfo['realname'] , password = _userinfo['password'], email = _userinfo['email'], area = Area.objects.get(id=1) ) #try: _user.save() _state['success'] = True _state['message'] = '注册成功.' #except: #_state['success'] = False #_state['message'] = '程序异常,注册失败.' # send regist success mail mailer.send_regist_success_mail(_userinfo) return _state
def __do_signup(request,_userinfo): _state = { 'success' : False, 'message' : '', } # check username exist if(_userinfo['username'] == ''): _state['success'] = False _state['message'] = _('"Username" have not inputed.') return _state if(_userinfo['password'] == ''): _state['success'] = False _state['message'] = _('"Password" have not inputed.') return _state if(_userinfo['realname'] == ''): _state['success'] = False _state['message'] = _('"Real Name" have not inputed.') return _state if(_userinfo['email'] == ''): _state['success'] = False _state['message'] = _('"Email" have not inputed.') return _state # check username exist if(__check_username_exist(_userinfo['username'])): _state['success'] = False _state['message'] = _('"Username" have existed.') return _state # check password & confirm password if(_userinfo['password'] != _userinfo['confirm']): _state['success'] = False _state['message'] = _('"Confirm Password" have not match.') return _state _user = User( username = _userinfo['username'], realname = _userinfo['realname'] , password = _userinfo['password'], email = _userinfo['email'], area = Area.objects.get(id=1) ) #try: _user.save() _state['success'] = True _state['message'] = _('Successed.') #except: #_state['success'] = False #_state['message'] = '程序异常,注册失败.' # send regist success mail mailer.send_regist_success_mail(_userinfo) return _state
def __do_signup(request, _userinfo): _state = { 'success': False, 'message': '', } # check username exist if (_userinfo['username'] == ''): _state['success'] = False _state['message'] = '用户名未输入.' return _state if (_userinfo['password'] == ''): _state['success'] = False _state['message'] = '密码未输入.' return _state if (_userinfo['realname'] == ''): _state['success'] = False _state['message'] = '姓名未输入.' return _state if (_userinfo['email'] == ''): _state['success'] = False _state['message'] = 'email未输入.' return _state # check username exist if (__check_username_exist(_userinfo['username'])): _state['success'] = False _state['message'] = '用户名已存在.' return _state # check password & confirm password if (_userinfo['password'] != _userinfo['confirm']): _state['success'] = False _state['message'] = '确认密码不正确.' return _state _user = User(username=_userinfo['username'], realname=_userinfo['realname'], password=_userinfo['password'], email=_userinfo['email'], area=Area.objects.get(id=1)) #try: _user.save() _state['success'] = True _state['message'] = '注册成功.' #except: #_state['success'] = False #_state['message'] = '程序异常,注册失败.' # send regist success mail mailer.send_regist_success_mail(_userinfo) return _state
def __do_signup(request, _userinfo): _state = { 'success': True, 'message': '', } # check username exist if _userinfo['username'] == '': _state['success'] = False _state['message'] = _('"Username" have not been inputed.') return _state if _userinfo['password'] == '': _state['success'] = False _state['message'] = _('"Password" have not been inputed.') return _state if _userinfo['realname'] == '': _state['success'] = False _state['message'] = _('"Realname" have not been inputed.') return _state if _userinfo['email'] == '': _state['success'] = False _state['message'] = _('"Email" have not been inputed.') return _state # check username whether had existed if __check_username_exist(_userinfo['username']): _state['success'] = False _state['message'] = _('"Username" have existed') return _state # check password & confirm password 检查两次密码输入是否匹配 if _userinfo['password'] != _userinfo['confirm']: _state['success'] = False _state['message'] = _('"Confirm Passwords" have not matched.') return _state _user = User(username=_userinfo['username'], realname=_userinfo['realname'], password=_userinfo['password'], email=_userinfo['email'], area=Area.objects.get(id=1)) _user.user_save() return _state