头像被墙
This commit is contained in:
parent
2ae681ccbe
commit
39c9746abf
|
@ -85,7 +85,7 @@ def data_factory(app, handler):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def response_factory(app, handler):
|
def response_factory(app, handler):
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def response(request):
|
def response(request, t=None):
|
||||||
logging.info('Response handler...')
|
logging.info('Response handler...')
|
||||||
r = yield from handler(request)
|
r = yield from handler(request)
|
||||||
if isinstance(r, web.StreamResponse):
|
if isinstance(r, web.StreamResponse):
|
||||||
|
|
|
@ -11,7 +11,7 @@ import markdown2
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
|
||||||
from coroweb import get, post
|
from coroweb import get, post
|
||||||
from apis import Page, APIValueError, APIResourceNotFoundError
|
from apis import Page, APIValueError, APIResourceNotFoundError, APIPermissionError, APIError
|
||||||
|
|
||||||
from models import User, Comment, Blog, next_id
|
from models import User, Comment, Blog, next_id
|
||||||
from config import configs
|
from config import configs
|
||||||
|
@ -249,7 +249,7 @@ def api_register_user(*, email, name, passwd):
|
||||||
raise APIError('register:failed', 'email', 'Email is already in use.')
|
raise APIError('register:failed', 'email', 'Email is already in use.')
|
||||||
uid = next_id()
|
uid = next_id()
|
||||||
sha1_passwd = '%s:%s' % (uid, passwd)
|
sha1_passwd = '%s:%s' % (uid, passwd)
|
||||||
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='http://www.gravatar.com/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
|
user = User(id=uid, name=name.strip(), email=email, passwd=hashlib.sha1(sha1_passwd.encode('utf-8')).hexdigest(), image='https://dn-qiniu-avatar.qbox.me/avatar/%s?d=mm&s=120' % hashlib.md5(email.encode('utf-8')).hexdigest())
|
||||||
yield from user.save()
|
yield from user.save()
|
||||||
# make session cookie:
|
# make session cookie:
|
||||||
r = web.Response()
|
r = web.Response()
|
||||||
|
|
Loading…
Reference in New Issue