You are not logged in.
Hi,
I am creating user account if not already created using json api CreateUser. Currently user is receiving email to reset password and it also activate user.
Is there any way that i can activate user by API and auto login him from my application using impersonate.
Regards
Farhana
Offline
Hi Farhana,
Via the API there is no need for a separate activation step: that is only required for the user to choose a password.
Using the API method Users.SetAuthMode you can change the authentication mechanism to "no_password" - in this state, they will not be able to log in directly or set a password.
You can log them in from your application by calling Core.GetAuthorisedURL and directing the user to the returned URL.
Dominic
Offline
Thank you very much. it worked for me.
Offline
hi there,
I am having a problem with user creation using API with no-password option. Users are still getting emails with change password link and when they click the link, it does not work for them.
and then they are unable to access the system at all. always get redirect to changepassword page.
is there any solution for this. it is urgent please.
this is the code for user creation
var createUser = new
{
action = "Users.CreateUser",
apiVersion = "1.0",
inParams =
new
{
username = userName,
description = string.Format("{0} {1}", employee.Firstname, employee.Surname),
email = employee.EmailAddress,
preset = "g:" + _userGroupId
},
sessionId = _sessionId
};
response = client.PostAsJsonAsync("/api.json.tlx", createUser).Result;
if (response.IsSuccessStatusCode)
{
result = response.Content.ReadAsStringAsync().Result;
var newUserId = JsonConvert.DeserializeObject<JsonResponse<NewUserIdOutParams>>(result).outParams.id;
var setAuthMode = new
{
action = "Users.SetAuthMode",
apiVersion = "1.0",
inParams =
new
{
userId = newUserId,
authMode = "no_password"
},
sessionId = _sessionId
};
client.PostAsJsonAsync("/api.json.tlx", setAuthMode);
Regards,
Farhana
Last edited by FarhanaJabbar (2014-02-03 12:01:44)
Offline
Hi Farhana,
Thanks for the details. Unfortunately there isn't currently a way to use the CreateUser() call without it sending an email. We would need to change it so that it can accept another argument that allows you to specify whether an email should be sent or not. I shall write this up as a feature request.
I'm sorry that we didn't know about this earlier as we might have been able to add something before you launched but I shall separately write back to David and yourself on the support ticket.
Best Regards,
Steve
Offline
IMS 6.0.18-3 versions and above will feature an extra argument to control whether the welcome email is sent:
Users.CreateUser(string username, string description, string email[, string preset = "normal"][, bool welcomeEmail = true]) → hash
Offline