Esempio n. 1
0
    def post(self):
        name = self.get_argument('name', '')
        mail = self.get_argument('mail', '')
        errtip = Errtip()
        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

        if not name:
            errtip.name = '请输入姓名'


        if not errtip:
            user_id = user_id_by_mail(mail)
            if not user_id:
                user_id = user_new(mail, name=name)
                #session = user_session(user_id)
                #self.set_cookie('S', session)
                self.set_cookie('E', mail)

                phone = self.get_argument('phone', '')
                namecard_new(user_id,phone=phone)

            return self.redirect('/auth/reged/%s'%user_id)

        self.render(
            mail=mail,
            name=name,
            errtip=errtip
        )
Esempio n. 2
0
    def post(self):
        name = self.get_argument('name', '')
        mail = self.get_argument('mail', '')
        errtip = Errtip()
        if mail:
            mail = mail.lower()
        if not mail:
            errtip.mail = '请输入邮箱'
        elif not EMAIL_VALID.match(mail):
            errtip.mail = '邮箱格式有误'

        if not name:
            errtip.name = '请输入姓名'

        if not errtip:
            user_id = user_id_by_mail(mail)
            if not user_id:
                user_id = user_new(mail, name=name)
                #session = user_session(user_id)
                #self.set_cookie('S', session)
                self.set_cookie('E', mail)

                phone = self.get_argument('phone', '')
                namecard_new(user_id, phone=phone)

            return self.redirect('/auth/reged/%s' % user_id)

        self.render(mail=mail, name=name, errtip=errtip)
Esempio n. 3
0
 def post(self):
     current_user_id = self.current_user_id
     pid_now = self.get_argument('pid_now', '1')
     pid_now = int(pid_now)
     if pid_city(pid_now):
         namecard_new(current_user_id, pid_now)
         self.redirect('/%s' % pid_now)
     else:
         self.render(pid_now=pid_now or 0, error='请选择现居城市')
Esempio n. 4
0
 def post(self):
     current_user_id = self.current_user_id
     pid_now = self.get_argument('pid_now', '1')
     pid_now = int(pid_now)
     if pid_city(pid_now):
         namecard_new(current_user_id, pid_now)
         self.redirect('/%s'%pid_now)
     else:
         self.render(pid_now=pid_now or 0, error='请选择现居城市')
Esempio n. 5
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument('name', None)
    if name and not name.isdigit():
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument('motto', None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument('txt', '')
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument('birthday', '0')
    birthday = int(birthday)
    marry = self.get_argument('marry', '')
    pid_home = self.get_argument('pid_home', '1')
    pid_now = self.get_argument('pid_now', '1')
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument('sex', 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)
Esempio n. 6
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument('name', None)
    if name:
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument('motto', None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument('txt', '')
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument('birthday', '0')
    birthday = int(birthday)
    marry = self.get_argument('marry', '')
    pid_home = self.get_argument('pid_home', '1')
    pid_now = self.get_argument('pid_now', '1')
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument('sex', 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)
Esempio n. 7
0
def save_user_info(self):
    current_user_id = self.current_user_id

    name = self.get_argument("name", None)
    if name and not name.isdigit():
        zsite_name_edit(current_user_id, name)

    motto = self.get_argument("motto", None)
    if motto:
        _motto.set(current_user_id, motto)

    txt = self.get_argument("txt", "")
    if txt:
        txt_new(current_user_id, txt)

    birthday = self.get_argument("birthday", "0")
    birthday = int(birthday)
    marry = self.get_argument("marry", "")
    pid_home = self.get_argument("pid_home", "1")
    pid_now = self.get_argument("pid_now", "1")
    try:
        pid_now = int(pid_now)
    except ValueError:
        pid_now = 0
    try:
        pid_home = int(pid_home)
    except ValueError:
        pid_home = 0

    marry = int(marry)
    if marry not in (1, 2, 3):
        marry = 0

    o = user_info_new(current_user_id, birthday, marry, pid_home)
    if pid_now:
        c = namecard_get(current_user_id)
        if c:
            c.pid_now = pid_now
            c.save()
        else:
            c = namecard_new(current_user_id, pid_now=pid_now)

    if not o.sex:
        sex = self.get_argument("sex", 0)
        if sex and not o.sex:
            sex = int(sex)
            if sex not in (1, 2):
                sex = 0
            if sex:
                if o:
                    o.sex = sex
                    o.save()
                else:
                    user_info_new(current_user_id, sex=sex)

    search_new(current_user_id)
Esempio n. 8
0
    def save(self):
        current_user = self.current_user
        current_user_id = self.current_user_id
        pid_now = self.get_argument("pid_now", "1")
        name = self.get_argument("name", "")
        phone = self.get_argument("phone", "")
        mail = self.get_argument("mail", "")
        address = self.get_argument("address", "")

        pid_now = int(pid_now)

        if pid_now or name or phone or mail or address:
            c = namecard_new(current_user_id, pid_now, name, phone, mail, address)
            return c
Esempio n. 9
0
    def save(self):
        current_user = self.current_user
        current_user_id = self.current_user_id
        pid_now = self.get_argument('pid_now', '1')
        name = self.get_argument('name', '')
        phone = self.get_argument('phone', '')
        mail = self.get_argument('mail', '')
        address = self.get_argument('address', '')

        pid_now = int(pid_now)

        if pid_now or name or phone or mail or address:
            c = namecard_new(current_user_id, pid_now, name, phone, mail,
                             address)
            return c
Esempio n. 10
0
    def save(self):
        current_user = self.current_user
        current_user_id = self.current_user_id
        pid_now = self.get_argument('pid_now', '1')
        name = self.get_argument('name', '')
        phone = self.get_argument('phone', '')
        mail = self.get_argument('mail', '')
        address = self.get_argument('address', '')

        pid_now = int(pid_now)

        if pid_now or name or phone or mail or address:
            c = namecard_new(
                current_user_id, pid_now, name, phone, mail, address
            )
            return c