# -*- coding: utf-8 -*-

from django.shortcuts import render

from account.models import LensmanInfo


def user_agreement(request):
    return render(request, 'page/user_agreement.html', {})


def contact_us(request):
    return render(request, 'page/contact_us.html', {})


def lensman_oauth(request):
    unionid = request.GET.get('unionid', '')

    try:
        lensman = LensmanInfo.objects.get(unionid=unionid)
    except LensmanInfo.DoesNotExist:
        lensman = None

    return render(request, 'page/lensman_oauth.html', {
        'lensman_info': lensman and lensman.data,
        'modified': bool((not lensman) or (lensman and lensman.user_status in [LensmanInfo.UNVERIFIED, LensmanInfo.REFUSED])),  # 是否可以更改信息
    })
