I'm very new to DotNetNuke but I'm creating a custom module where a user can update their details which will then be saved. One of these things is the password. I dont know the best way to insert something into the DotNetNuke database or which table the password is stored in. Can anyone help me with this?
Thanks
EDIT: I've noticed a "ChangePassword" function under the UserController class which would sound like it would do the trick, however its asking for the old password of the user which I don't know how to get
You don't need to know the old password, use
MembershipProvider.Instance().ResetAndChangePassword(user, "password");
where user is UserInfo type object of your user, "password" is the string with new password.
It works in dnn 7.
I have had success getting and updating a user's password using the following code.
strUsername = Entities.Users.UserController.GetCurrentUserInfo.Username
strPassword = Membership.Provider.GetPassword(strUsername, String.Empty)
Membership.Provider.ChangePassword(strUsername, strPassword, txtPassword.Text)
Related
In my project, the password is hashed and saved in the database, but how can I get the origin password if I forgot the password?
You can't, that's the whole point of using a hash.
If someone forgot their password, then they should set a new one, ie you should implement some form of password reset functionality accordingly.
You can't have it ! If user forgot his password, you can send him a link to create a new one (with questions to check his identity).
I'm trying to transfer a cakephp3 application from my local linux server to a online webhoster.
I managed to migrate the database and put it online. The only way to connect to the internet for me is through a proxy right now. However this proxy blocks the website, so I'm using a webproxy (proxfree.net and hide.me) to access the website.
Whenever I try to login I get a 'invalid username or password'.
When I try to create a new user, it saves a record, but with an empty field for the pseudonym (username).
I wrote a test for the database connection
$db = ConnectionManager::get('default');
echo "To database ".($db->isConnected()?"connected":"disconnected")."\n";
It says it's connected to the database. I'm also able to print the usernames on the login-site, so the database-connection works definitely.
Login: marcusmoenius.bplaced.net/app/users/login
Add user: marcusmoenius.bplaced.net/app/users/add
Does anyone know, why I can't login? Is anyone else able to login? It worked on my local machine
example username and password:
username: Stella
password: Superman
OK, so it was no problem with the webspace, but with my understanding of the cakephp-functionality.
Apperantly the passwords-hashes don't match on the webhoster. So I needed to add new users with new-hashed passwords.
But the registration of new users didn't work, because I marked the pseudonym-field as not _accessible in the users-table. So when I invoked the patchEntity-method in the controller, it didn't apply the pseudonym-field and hence didn't put a valid record in the database.
I have a straight up question. I am developing a SaaS web application in php.
I have a database for each user when the user registers to the website.
I wanted to know how do i go about, in the login form when the user logs in, it automatically selects the correct database. I dont know how to implement this feature and I thought you guys might help me out.
Did not find anything on google.
Thank you in advance
Using the mysqli library, you pass in the database name as a string as the last argument, so if you have a session variable called username, you can do
$database = $_SESSION['username'];
$mysqli = new mysqli("localhost", "db_user", "db_pass", $database);
I have used the Silverlight BusinessApplication template in VS2010. I have changed the AuthenticationService to use my own Authentication methods - the requirement is that the user logs into the system with their SQL login (no AD in the company).
On login, I construct a SQLConnection, attempt to open it, then I get their details (friendly name, roles etc) from a User table. I then store the username and password that they entered and any time they hit the DB through a DomainService I override CreateObjectContext and insert the username and password they entered into the DB.
I have changed the AuthenticationService to inherit from IAuthentication and LinqToEntitiesDomainService, mainly for accessing the User table.
I'm running into an issue when starting the application, before the user has logged in. The LoginStatus control that comes with the BusinessApplication template has the following line:
private readonly AuthenticationService authService = WebContext.Current.Authentication;
This causes the constructor of my AuthenticationService to be called and, as part of that, the ObjectContext is attempted to be created but the user has not yet logged in so I have no username + password to add into the connection string. For dev. purposes I just use my username and password if not logged in but I'm now required to fix this.
Any ideas on how I can get round this? My options as far as I can see are:
Don't use EF (I would rather use it as the rest of my data access is done using EF).
Create a dummy user in the DB and use this as the credentials if not logged in (not ideal).
Is there another way round this? On construction of my AuthenticationService prevent CreateObjectContext being called?
Any help/suggestions appreciated.
Update
I changed my AuthenticationService to inherit from DomainService rather than LinqToEntitiesDomainService and used a SqlDataReader to get the User data that was required but I'm stil curious as to whether there is another way.
Follow this example:
http://code.msdn.microsoft.com/Custom-Authentication-96ca3d20/view/Reviews
Note that there is a DbDomainService in case you use DbContext, not ObjectContext.
I am using asp.net mvc along with SQL server. An user of my application created a username like "abcd efgh", with space between the user name. it worked for some time and now it stopped working. I checked that user is entering the correct data. This happened even user did not have a space in it. I set up the membership database using Aspnet_regsql.exe.
Any help in trouble shooting this is appreciated.
Are you sure that you are not parsing/modifying the username or password before giving it to Membership?
Why don't you set a breakpoint in your Controller Action and see what username and password are at that point?