Restore password feature

21 views
Skip to first unread message

Sergey B.

unread,
Sep 1, 2017, 5:19:51 AM9/1/17
to Union Platform
Does union server has a feature to restore user password? If not, does anyone have a snippet to use with union's default database?

Armand Niculescu

unread,
Oct 12, 2017, 9:01:20 AM10/12/17
to Union Platform
Well, the built-in database is easy to use but very difficult to integrate with something else. Union supports different data sources and for serious work I recommend you using MySQL (or something like that). There's a tutorial on the site for a MySQL datasource here: http://www.unionplatform.com/?page_id=3721.
With a server datasource you have the advantage of being able to write a separate password recovery script and whatever else you need (however, if you change an account attribute directly in MySQL, you must clear the account cache in Union).

Toby G

unread,
Jul 26, 2018, 12:58:28 AM7/26/18
to Union Platform
Without being sure what you mean by "restore user password",  here are some things you can do:

In your server side modules, there is a Server class and an Account class.
 
With these two methods you can do pretty much whatever you want with passwords.
(Note that, shockingly, passwords are stored in clear text.)

server.changeAccountPassword(AccountName, currentPassword, newPassword)

account.getPassword()

If you just want to "recover" an existing password, use account.getPassword and return it to the user.
Or you can just write a new one by first retrieving the old one, and then changing it to something else.

These should work no matter what your data store is, default or otherwise.

Note: for retrieving passwords, my code looks like this:
var account = server.getAccount(name);
pw = account.getPassword();
account.dispose();

There is some warning about account instances that says you have to do that, but I don't remember the details.

Reply all
Reply to author
Forward
0 new messages