mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Fix a few showstoppers in the Services changes.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import hashlib
|
||||
import random
|
||||
import re
|
||||
import unicodedata
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render_to_response
|
||||
@@ -135,9 +137,7 @@ def service_add(request):
|
||||
form = clsform(request.POST)
|
||||
if form.is_valid():
|
||||
|
||||
acc = ServiceAccount()
|
||||
acc.user = request.user
|
||||
acc.service = form.cleaned_data['service']
|
||||
acc = ServiceAccount(user=request.user, service=form.cleaned_data['service'])
|
||||
acc.character = form.cleaned_data['character']
|
||||
|
||||
if acc.service.settings['require_password']:
|
||||
@@ -149,7 +149,7 @@ def service_add(request):
|
||||
acc.password = None
|
||||
|
||||
# Decode unicode and remove invalid characters
|
||||
username = re.sub('[^a-zA-Z0-9_-]+', '', unicodedata.normalize('NFKD', self.character.name).encode('ASCII', 'ignore'))
|
||||
username = re.sub('[^a-zA-Z0-9_-]+', '', unicodedata.normalize('NFKD', acc.character.name).encode('ASCII', 'ignore'))
|
||||
|
||||
if acc.service.api_class.check_user(username):
|
||||
error = "Username already exists on the target service, please contact an admin."
|
||||
|
||||
Reference in New Issue
Block a user