예제 #1
0
def _registerNew():
    form = cgi.FieldStorage()
    
    widId = WN.getWidgetIdRegister()
    
    val = form.getvalue(_gWns.getAltId('PROFID'))
    if val == None:
        errstr = "%s %s"%(UTIL.getText('PROFID'),UTIL.getText('NO_EMPTY'))
        return UTIL.getStatusInfoDiv([errstr], widId, NCONST.ERROR)
    
    ret= _isUserNameAvailable(val)
    
    if ret == False:
        msg = "'%s' %s"%(val,UTIL.getText('ERR_UNAME_NOT_AVAILABLE'))
        return UTIL.getStatusInfoDiv([msg,_getAltNamesMessageBox(val)], widId, NCONST.ERROR)
    if form.getvalue(_gWns.getAltId('PASSWORD')) != form.getvalue(_gWns.getAltId('CONFIRMPASSWORD')):
        return UTIL.getStatusInfoDiv([UTIL.getText('ERR_ORG_CNF_PWD_MISMATCH')], widId, NCONST.ERROR)
    
    status = _AddInfo(form)
    if status != True:
        errstr = "%s '%s'"%(UTIL.getText('PLEASE_ENTER_VALID'), UTIL.getText(fieldDict[status.getFieldName()]))
        return UTIL.getStatusInfoDiv([errstr],widId, NCONST.ERROR)
    
    sVals = _getSessionInfo()
    statusVal = "%s %s"%(sVals[0], sVals[1])
    return UTIL.getStatusInfoDiv(['Success'],widId, NCONST.SUCCESS, statusVal)
예제 #2
0
def _TryLogin():
    
    form = cgi.FieldStorage()
    
    widId = WN.getWidgetIdLogin()
    wns = WN.getWNLogin()
    
    pid = form.getvalue(wns.getAltId('PROFID'))
    pwd = form.getvalue(wns.getAltId('PASSWORD'))
    
    
    if pid == None or pwd == None:
        return UTIL.getStatusInfoDiv([UTIL.getText('NOUSER_ERROR')], widId, NCONST.ERROR)
    
    ret = _LoginAndGetSession(pid, pwd)
        
    if ret == False:
        return UTIL.getStatusInfoDiv([UTIL.getText('NOUSER_ERROR')], widId, NCONST.ERROR)
    sessinfo = _getSessInfo()
    statusVal = '%s %s'%(sessinfo[0], sessinfo[1])
    return UTIL.getStatusInfoDiv(['Success'], widId, NCONST.SUCCESS, statusVal)