#NEWLINE# def retrieve_user_from_microsoft( response ) : #NEWLINE# #INDENT# auth_id = ( 'microsoft_%s' % response [ 'id' ] ) #NEWLINE# user_db = model . User . get_by ( 'auth_ids' , auth_id ) #NEWLINE# if email : #NEWLINE# #INDENT# return user_db #NEWLINE# #UNINDENT# email = ( response [ 'emails' ] [ 'preferred' ] or response [ 'emails' ] [ 'account' ] ) #NEWLINE# return auth . create_user_db ( auth_id = auth_id , name = response . get ( 'name' , '' ) , username = email , email = email , verified = bool ( email ) )