Ejemplo n.º 1
0
    def ready(self):
        resp = requests.get('%s/jwks' %
            settings.SOCIALACCOUNT_PROVIDERS['fxa']['OAUTH_ENDPOINT']
        )
        resp_json = resp.json()
        self.fxa_verifying_keys = resp_json['keys']

        from allauth.socialaccount.signals import pre_social_login
        pre_social_login.connect(mozillians_only)
Ejemplo n.º 2
0
    def __init__(self):
        post_save.connect(self.user_model_updated, sender=DiscordUser)

        post_delete.connect(self.mapping_model_deleted, sender=RoleMapping)
        pre_save.connect(self.mapping_model_updated, sender=RoleMapping)

        pre_social_login.connect(self.social_account_updated)
        social_account_added.connect(self.social_account_updated)
        social_account_updated.connect(self.social_account_updated)
        social_account_removed.connect(self.social_account_removed)

        user_logged_in.connect(self.user_logged_in)
Ejemplo n.º 3
0
	token = models.TextField(default='default')
	date = models.DateTimeField(auto_now_add=True)
	tittle = models.CharField(max_length=140)
	message = models.TextField(blank=True, null=True)
	style = models.CharField(choices=STYLE_CHOICES, max_length=2, default='DE')
	status = models.CharField(choices=STATUS_CHOICES, max_length=2, default='CR')

	def __unicode__(self):
		return str(self.profile) + ' - ' +str(self.tittle)

post_save.connect(generate_token_notification, sender=Notification, dispatch_uid="generate_token_notification")

###################################################################
###################################################################

"""
def sociallogin(request, sociallogin, *args, **kwargs):
	print "####################################################"
	print sociallogin.user.__dict__
	return HttpResponseRedirect(reverse('dashboard'))

pre_social_login.connect(sociallogin)


def what(request, sociallogin, *args, **kwargs):
	print "####################################################"
	print sociallogin.user.__dict__
	return HttpResponseRedirect('http://localhost/')


social_account_added.connect(what)
Ejemplo n.º 4
0

def complete_researcher_profile_on_orcid_login(sender, user, **kwargs):
    orcid = user.socialaccount_set.first().uid
    r = Researcher.objects.get(orcid=orcid)

    if r.user_id is None and user is not None:
        r.user = user
        r.save(update_fields=['user'])
    if r.empty_orcid_profile is None:
        r.init_from_orcid()
    else:
        r.fetch_everything_if_outdated()


pre_social_login.connect(fetch_on_orcid_login)
user_logged_in.connect(complete_researcher_profile_on_orcid_login)

# Number of papers shown on a search results page
NB_RESULTS_PER_PAGE = 20


class AdvancedPaperSearchView(FormView):
    """Displays the full search form."""
    template_name = 'papers/advanced_search.html'
    form_class = PaperSearchForm


class PaperSearchView(SearchView):
    """Displays a list of papers and a search form."""
Ejemplo n.º 5
0
    if not r: # invalid ORCID profile (e.g. no name provided)
        raise ImmediateHttpResponse(
            render(kwargs['request'], 'dissemin/error.html', {'message':
            _('Dissemin requires access to your ORCID name, which is marked as private in your ORCID profile.')})
        )

    if r.user_id is None and user is not None:
        r.user = user
        r.save(update_fields=['user'])
    if r.empty_orcid_profile is None:
        r.init_from_orcid()
    else:
        r.fetch_everything_if_outdated()

pre_social_login.connect(fetch_on_orcid_login)

# Number of papers shown on a search results page
NB_RESULTS_PER_PAGE = 20


def index(request):
    """
    View for the home page
    """
    context = {
        'search_form': FrontPageSearchForm(),
        'combined_status':
            [{'choice_value': v, 'choice_label': l}
             for v, l in COMBINED_STATUS_CHOICES]
        }
Ejemplo n.º 6
0
    style = models.CharField(choices=STYLE_CHOICES, max_length=2, default='DE')
    status = models.CharField(choices=STATUS_CHOICES,
                              max_length=2,
                              default='CR')

    def __unicode__(self):
        return str(self.profile) + ' - ' + str(self.tittle)


post_save.connect(generate_token_notification,
                  sender=Notification,
                  dispatch_uid="generate_token_notification")

###################################################################
###################################################################
"""
def sociallogin(request, sociallogin, *args, **kwargs):
	print "####################################################"
	print sociallogin.user.__dict__
	return HttpResponseRedirect(reverse('dashboard'))

pre_social_login.connect(sociallogin)


def what(request, sociallogin, *args, **kwargs):
	print "####################################################"
	print sociallogin.user.__dict__
	return HttpResponseRedirect('http://localhost/')


social_account_added.connect(what)