def notify_connect(strategy, backend, user, social, **kwargs): """Store verified email.""" notify_account_activity(user, strategy.request, 'auth-connect', method=get_auth_name(backend.name), name=social.uid)
def password_reset(strategy, backend, user, social, details, weblate_action, current_partial, **kwargs): """Set unusable password on reset.""" if (strategy.request is not None and user is not None and weblate_action == 'reset'): notify_account_activity( user, strategy.request, 'reset', method=get_auth_name(backend.name), name=social.uid, password=user.password ) user.set_unusable_password() user.save(update_fields=['password']) # Remove partial pipeline, we do not need it strategy.clean_partial_pipeline(current_partial.token) # Store user ID strategy.request.session['perform_reset'] = user.pk # Set short session expiry strategy.request.session.set_expiry(90) # Redirect to form to change password return redirect('password_reset') return None
def notify_disconnect(strategy, backend, entries, user, **kwargs): """Store verified email.""" for social in entries: AuditLog.objects.create(user, strategy.request, 'auth-disconnect', method=get_auth_name(backend.name), name=social.uid)
def notify_disconnect(strategy, backend, entries, user, **kwargs): """Store verified email.""" for social in entries: notify_account_activity(user, strategy.request, 'auth-disconnect', method=get_auth_name(backend.name), name=social.uid)
def get_params(self): from weblate.accounts.templatetags.authnames import get_auth_name result = {} result.update(self.params) if "method" in result: # The gettext is here for legacy entries which contained method name result["method"] = gettext(get_auth_name(result["method"])) return result
def notify_disconnect(strategy, backend, entries, user, **kwargs): """Store verified email.""" for social in entries: AuditLog.objects.create( user, strategy.request, 'auth-disconnect', method=get_auth_name(backend.name), name=social.uid )
def notify_disconnect(strategy, backend, entries, user, **kwargs): """Store verified email.""" for social in entries: notify_account_activity( user, strategy.request, 'auth-disconnect', method=get_auth_name(backend.name), name=social.uid )
def reauthenticate(strategy, backend, user, social, uid, **kwargs): """Force authentication when adding new association.""" if strategy.request.session.pop('reauthenticate_done', False): return if user and not social and user.has_usable_password(): strategy.request.session['reauthenticate'] = { 'backend': backend.name, 'backend_verbose': get_auth_name(backend.name), 'uid': uid, 'done': False, } return redirect('confirm')
def reauthenticate(strategy, backend, user, social, uid, **kwargs): """Force authentication when adding new association.""" if strategy.request.session.pop('reauthenticate_done', False): return if user and not social and user.has_usable_password(): strategy.request.session['reauthenticate'] = { 'backend': backend.name, 'backend_verbose': get_auth_name(backend.name), 'uid': uid, 'done': False, } return redirect('confirm')
def password_reset(strategy, backend, user, social, details, weblate_action, **kwargs): """Set unusable password on reset.""" if (strategy.request is not None and user is not None and weblate_action == 'reset'): user.set_unusable_password() user.save(update_fields=['password']) notify_account_activity(user, strategy.request, 'reset', method=get_auth_name(backend.name), name=social.uid)
def notify_connect(strategy, backend, user, social, new_association=False, is_new=False, **kwargs): """Notify about adding new link.""" if new_association and not is_new: notify_account_activity(user, strategy.request, 'auth-connect', method=get_auth_name(backend.name), name=social.uid)
def notify_connect(strategy, backend, user, social, new_association=False, is_new=False, **kwargs): """Notify about adding new link.""" if user and not is_new: if new_association: action = 'auth-connect' else: action = 'login' notify_account_activity( user, strategy.request, action, method=get_auth_name(backend.name), name=social.uid )
def password_reset(strategy, backend, user, social, details, weblate_action, **kwargs): """Set unusable password on reset.""" if (strategy.request is not None and user is not None and weblate_action == 'reset'): user.set_unusable_password() user.save(update_fields=['password']) notify_account_activity( user, strategy.request, 'reset', method=get_auth_name(backend.name), name=social.uid )
def notify_connect(strategy, backend, user, social, new_association=False, is_new=False, **kwargs): """Notify about adding new link.""" if user and not is_new: if new_association: action = 'auth-connect' else: action = 'login' AuditLog.objects.create( user, strategy.request, action, method=get_auth_name(backend.name), name=social.uid )
def reauthenticate(strategy, backend, user, social, uid, weblate_action, **kwargs): """Force authentication when adding new association.""" session = strategy.request.session if session.pop("reauthenticate_done", False): return None if weblate_action != "activation": return None if user and not social and user.has_usable_password(): session["reauthenticate"] = { "backend": backend.name, "backend_verbose": force_str(get_auth_name(backend.name)), "uid": uid, "user_pk": user.pk, } return redirect("confirm") return None
def reauthenticate(strategy, backend, user, social, uid, weblate_action, **kwargs): """Force authentication when adding new association.""" session = strategy.request.session if session.pop('reauthenticate_done', False): return None if weblate_action != 'activation': return None if user and not social and user.has_usable_password(): session['reauthenticate'] = { 'backend': backend.name, 'backend_verbose': force_text(get_auth_name(backend.name)), 'uid': uid, 'user_pk': user.pk, } return redirect('confirm') return None
def reauthenticate(strategy, backend, user, social, uid, weblate_action, **kwargs): """Force authentication when adding new association.""" session = strategy.request.session if session.pop('reauthenticate_done', False): return None if weblate_action != 'activation': return None if user and not social and user.has_usable_password(): session['reauthenticate'] = { 'backend': backend.name, 'backend_verbose': get_auth_name(backend.name), 'uid': uid, 'user_pk': user.pk, } return redirect('confirm') return None
def password_reset(strategy, backend, user, social, details, weblate_action, current_partial, **kwargs): """Set unusable password on reset.""" if strategy.request is not None and user is not None and weblate_action == "reset": AuditLog.objects.create( user, strategy.request, "reset", method=force_str(get_auth_name(backend.name)), name=social.uid, password=user.password, ) user.set_unusable_password() user.save(update_fields=["password"]) # Remove partial pipeline, we do not need it strategy.really_clean_partial_pipeline(current_partial.token) session = strategy.request.session # Store user ID session["perform_reset"] = user.pk # Set short session expiry session.set_expiry(90) # Redirect to form to change password return redirect("password_reset") return None