I'm trying to log on WSO2-IS new console and myaccount as user admin and I'm getting an error:
http://localhost:9443/console/login
http://localhost:9443/myaccount/login
Invalid username! Username should be an E-Mail address.
I've already check user permission on carbon console as admin and it seems OK:
I added the tenant to enable email as domain but I forgot to put the user admin to use email address as the username:
[tenant_mgt]
enable_email_domain= true
[super_admin]
username = "admin#wso2.com"
password = "admin"
I also added this user to the roles "Application/Console" and "Application/My Account".
Related
Somehow my super admin username or password has updated by mistake in WSO2IS. How to reset it to username=admin and password=admin. Now i can not login from my admin account.
You can try changing the username and password using the deployment.toml file located in <IS_HOME>/repository/conf directory. You can find the below configuration there. Change this according to your need.
[super_admin]
username = "admin"
password = "admin"
How do i override AllAuth default LoginView to allow users to login only if their email address is verified?
From the Aullauth configuration docs
You need to set: ACCOUNT_EMAIL_VERIFICATION="mandatory"
When set to “mandatory” the user is blocked from logging in until the email address is verified. Choose “optional” or “none” to allow logins with an unverified e-mail address. In case of “optional”, the e-mail verification mail is still sent, whereas in case of “none” no e-mail verification mails are sent.
Also keep in mind before setting it you need to also set ACCOUNT_EMAIL_REQUIRED=True
Setting this to “mandatory” requires ACCOUNT_EMAIL_REQUIRED to be True
How can I give the option to change Email-Id and change Password for users logged in through AllAuth [Gmail / Facebook].
Is there away to authenticate username and password in Django. all i can find is
https://simpleisbetterthancomplex.com/tutorial/2017/02/18/how-to-create-user-sign-up-view.html
this it is just uses username authentication
Django by default authenticating the user by using of username. If you want to authenticate the user with email instead of username you can check this tutorial. Authenticate user with email instead of username
It might be worth your while to look at allauth. https://django-allauth.readthedocs.io/en/latest/overview.html
I implemented registration and login with django-allauth and django-rest-auth. I can successfully login with Facebook to the server with both allauth and rest-auth (web and mobile).
When I'm trying to login with FB account that its email already exists (someone already signed up with that email), it shows the signup form. However, when I'm trying doing the same using rest-auth, I get an error:
Internal Server Error: /rest-auth/facebook/
IntegrityError at /rest-auth/facebook/
duplicate key value violates unique constraint "auth_user_username_key"
DETAIL: Key (username)=() already exists.
My Configuration:
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'optional'
SOCIALACCOUNT_AUTO_SIGNUP = True
SOCIALACCOUNT_EMAIL_VERIFICATION = False
SOCIALACCOUNT_EMAIL_REQUIRED = True
SOCIALACCOUNT_QUERY_EMAIL = True
I solved the issue by creating a social adapter that connects the existing account to the social account.
Please make sure you're aware of the risks before using it - if the email address is not verified in one of the accounts a malicious user might take control of the account by signing up before the social signup (for example).
class MySocialAccountAdapter(DefaultSocialAccountAdapter):
def pre_social_login(self, request, sociallogin):
user = sociallogin.user
if user.id:
return
if not user.email:
return
try:
user = User.objects.get(email=user.email) # if user exists, connect the account to the existing account and login
sociallogin.connect(request, user)
except User.DoesNotExist:
pass
except Exception as e:
logger.exception('Social adapter failure - {}'.format(e))
You need to set the path to the adapter in the settings.py:
SOCIALACCOUNT_ADAPTER = 'path.to.MySocialAccountAdapter'
The latest version of django-rest-auth v0.9.3 now includes social connect views, which allow you to link existing account to a social account.
In order to use them you need to be authenticated via existing account, due to security issues outlined in the previous answer. More info in the docs: Additional Social Connect Views
Unique constraint 500 error is fixed as well.