コード例 #1
0
ファイル: user.py プロジェクト: box327/Yuzuki
 def __init__(self, username, nickname, password, pd_realname, pd_email,
              pd_address, pd_phone, pd_bunryu, pd_bio):
     self.username = username
     self.nickname = nickname
     self.password = pbkdf2(password)
     self.pd_realname = pd_realname
     self.pd_email = pd_email
     self.pd_address = pd_address
     self.pd_phone = pd_phone
     self.pd_bunryu = pd_bunryu
     self.pd_bio = markdown_and_linkify(pd_bio) if pd_bio else pd_bio
コード例 #2
0
ファイル: user.py プロジェクト: Perlmint/Yuzuki
 def __init__(self, username, nickname, password, pd_realname, pd_email,
              pd_address, pd_phone, pd_bunryu, pd_bio):
     self.username = username
     self.nickname = nickname
     self.password = pbkdf2(password)
     self.pd_realname = pd_realname
     self.pd_email = pd_email
     self.pd_address = pd_address
     self.pd_phone = pd_phone
     self.pd_bunryu = pd_bunryu
     self.pd_bio = markdown_and_linkify(pd_bio) if pd_bio else pd_bio
コード例 #3
0
    def render_POST(self, request):
        if not request.user:
            raise Unauthorized()
        nickname = request.get_argument("nickname") or None
        password = request.get_argument("password") or None
        pd_realname = request.get_argument("pd_realname") or None
        pd_email = request.get_argument("pd_email") or None
        pd_address = request.get_argument("pd_address") or None
        pd_phone = request.get_argument("pd_phone") or None
        pd_bio = request.get_argument("pd_bio") or None
        slack_id = request.get_argument("slack_id") or None

        # error check
        err = None
        if nickname:
            query = request.dbsession.query(User)\
                                     .filter(User.nickname == nickname)
            if request.dbsession.query(query.exists()).scalar():
                err = u"이미 사용되고 있는 별명입니다."
            elif not re.match(u"^[-_a-zA-Z가-힣\\d\\(\\)]{1,}$", nickname):
                err = u"별명은 영문, 한글, 숫자, 붙임표(-), 밑줄(_)과 괄호만 사용할 수 있습니다."

        if err:
            context = {"err": err}
            request.setResponseCode(BAD_REQUEST)
            return render_template("profile_edit.html", request, context)

        if nickname:
            request.user.nickname = nickname
        if password:
            request.user.password = pbkdf2(password)
        if pd_realname:
            request.user.pd_realname = pd_realname
        if pd_email:
            request.user.pd_email = pd_email
        if pd_address:
            request.user.pd_address = pd_address
        if pd_phone:
            request.user.pd_phone = pd_phone
        if pd_bio:
            request.user.pd_bio = markdown_and_linkify(pd_bio)
        if slack_id is not None:
            request.user.slack_id = slack_id

        request.dbsession.commit()
        request.redirect("/profile/view")
        return "profile edit success"
コード例 #4
0
ファイル: user.py プロジェクト: box327/Yuzuki
 def change_password(self, password):
     self.password = pbkdf2(sha256(password).hexdigest())
コード例 #5
0
ファイル: user.py プロジェクト: Perlmint/Yuzuki
 def change_password(self, password):
     self.password = pbkdf2(sha256(password).hexdigest())