I've got a site setup where the user registration is set to 'Verified' but the link, that is emailed the new user to verify the account, is broken. The page says: "DNN Error No sites currently exist for this installation. - 503 Service Unavailable"
The link would look something like this:
[MYSITE]/default.aspx?ctl=Login&username=[USERNAME]&verificationcode=[CODE]
The site then rewrites it to:
[MYSITE]/login/username/[USERNAME]?verificationcode=[CODE]
After initial registration BUT before the user is verified, DNN automatically logs the user in (though limited access because they are unverified) but if user logs out THEN follows link from email, then verification works fine
Using DNN Version 08.00.04 (226)
Found solution here: https://github.com/dnnsoftware/Dnn.Platform/pull/1719/commits/cf956a062319e69ae5949efac4f8c5d4b475b0e7
Change 2 line in this file: /DesktopModules/AuthenticationServices/DNN/Login.ascx
Change line 46 from:
var actionLinks = $("a#dnn_ctr<%=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin");
To:
var actionLinks = $("a#dnn_ctr<%#ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin");
AND line 60 from:
var $loginButton = $('#dnn_ctr<%=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin');
To:
var $loginButton = $('#dnn_ctr<%#ModuleId > Null.NullInteger ? ModuleId.ToString() : ""%>_Login_Login_DNN_cmdLogin');
Related
I am using the python3.7.2 module simple-salesforce==0.74.2 and I am having trouble trying to establish a connection to my salesforce sandbox. I can login to the salesforce production with the same credentials just fine like so:
from simple_salesforce import Salesforce
sf = Salesforce(username='user#domain.com', password='pswd', security_token='mytoken')
Okay cool. Now I attempt to login to my sandbox with the following:
sf = Salesforce(username='user#domain.com.sandbox_name', password='pswd', security_token='mytoken', sandbox=True)
And I get the error:
simple_salesforce.exceptions.SalesforceAuthenticationFailed:
INVALID_LOGIN: Invalid username, password, security token; or user
locked out.
So I tried logging in with a different method:
sf = Salesforce(username='user#domain.com.sandbox_name', password='pswd', security_token='mytoken', domain='sandbox_name')
And this gave a different error:
requests.exceptions.ConnectionError:
HTTPSConnectionPool(host='sandbox_name.salesforce.com', port=443): Max
retries exceeded with url: /services/Soap/u/38.0 (Caused by
NewConnectionError(': Failed to establish a new connection: [Errno 8]
nodename nor servname provided, or not known'))
I am using a Developer sandbox, named sandbox_name, following salesforce's instructions. Can someone give some advice on what I am doing incorrectly?
Solved. Set domain='test' and generate a new token under your sandbox account
this didn't work for me, but what did was:
`sf = Salesforce(
username='my.email#test.com',
password='sadfd8d8d8',
security_token='d8d8asd8f8d8',
instance_url='https://my-dev-org-instance-dev-ed.my.salesforce.com')`
The advice here may be a bit deprecated. After a bit of tinkering, I was able to get the simple_salesforce library working with the Salesforce sandbox on a custom domain with the following code. Note the domain that I am passing to the api as well the sand_box name that needs to be appended to the username.
from simple_salesforce import Salesforce
USER = "user#domain.com.sandbox_name"
PASS = "pass"
SEC_TOKEN = "token"
DOMAIN = "<domain>--<sandbox_name>.<instance>.my"
sf = Salesforce(username=USER, password=PASS, security_token=SEC_TOKEN, domain=DOMAIN)
Am facing an obstacle using force.com site
a template email is used to send to portal users with direct link to some record in salesforce
example https://example.force.com/SamplePage?id=xxxxx
by trying to use refURL param half way was done as in the next example :
https://example.force.com?refURL=/SamplePage?id=xxxxx
but passing from an obstacle to facing another,now every time i click on the new link in the email i have to re-login again regardless that i just made a login.
so for the first attempt its logical to input the credentials to login to the site but i need to prevent when the session still on to re login again every time by clicking on the link from my email
my login code in Apex is as below :
global PageReference login() {
//Get refUrl
String strRefUrl = System.currentPageReference().getParameters().get('refURL');
//Get startUrl
String strStartUrl = System.currentPageReference().getParameters().get('startURL');
if(strRefUrl != null && strRefUrl != '' && ! strRefUrl.startsWithIgnoreCase(Site.getBaseInsecureUrl() )){
//Need to remove domain part because site.login() does not redirect to absolute URL
strStartUrl = strRefUrl.replace(Site.getBaseRequestUrl(),'');
}
else if (strRefUrl.startsWithIgnoreCase(Site.getBaseInsecureUrl())){
//Redirect to base URL if refUrl is empty
strStartUrl = Site.getBaseUrl() + '/LoginPage';
}
return Site.login(username, password, strStartUrl );
}
I have an unity app and use the google-play-games plugin with google *.aar versions 9.4.0. I lately changed my Backend (Google App Engine) from php to java. My problem is the following: in php the serverauthcode is used to get the users data (in JWT format) - it was working fine. So I changed to a Java servlet and I am failing since 2 days to get a valid idtoken. I am able to recieve the server auth code from my app and a valid token response is made by GoogleAuthorizationCodeTokenRequest (see code snippet). Unfortunately it does not contain any idtoken content but a valid auth_token. So I can not get the user id to identifiy the user. When I call tokenResponse.parseIdToken(); it is failing with a NullPointerException.
servlet code (authCode is the serverAuthCode I send from the play-games-plugin inside Unity to my GAE):
// (Receive authCode via HTTPS POST)
// Set path to the Web application client_secret_*.json file you downloaded from the
// Google Developers Console: https://console.developers.google.com/apis/credentials?project=_
// You can also find your Web application client ID and client secret from the
// console and specify them directly when you create the GoogleAuthorizationCodeTokenRequest
// object.
String CLIENT_SECRET_FILE = "/mypath/client_secret.json";
// Exchange auth code for access token
GoogleClientSecrets clientSecrets =
GoogleClientSecrets.load(
JacksonFactory.getDefaultInstance(), new FileReader(CLIENT_SECRET_FILE));
GoogleTokenResponse tokenResponse =
new GoogleAuthorizationCodeTokenRequest(
new NetHttpTransport(),
JacksonFactory.getDefaultInstance(),
clientSecrets.getDetails().getTokenUri(),
clientSecrets.getDetails().getClientId(),
clientSecrets.getDetails().getClientSecret(),
authCode,
REDIRECT_URI) // Specify the same redirect URI that you use with your web
// app. If you don't have a web version of your app, you can
// specify an empty string.
.execute();
String accessToken = tokenResponse.getAccessToken();
// Get profile info from ID token -> HERE IT THROWS AN EXCEPTION.
GoogleIdToken idToken = tokenResponse.parseIdToken();
GoogleIdToken.Payload payload = idToken.getPayload();
String userId = payload.getSubject(); // Use this value as a key to identify a user.
String email = payload.getEmail();
boolean emailVerified = Boolean.valueOf(payload.getEmailVerified());
String name = (String) payload.get("name");
String pictureUrl = (String) payload.get("picture");
String locale = (String) payload.get("locale");
String familyName = (String) payload.get("family_name");
String givenName = (String) payload.get("given_name");
the token response looks like (its invalid now):
{
"access_token" : "ya29.CjA8A7O96w-vX4OCSPm-GMEPGVIEuRTeOxKy_75z6fbYVSXsdi9Ot3NmxlE-j_t-BI",
"expires_in" : 3596,
"token_type" : "Bearer"
}
In my PHP GAE I always had a idToken inside this constuct which contained my encrypted data. But it is missing now?! So I asssume I do somthing differently in Java or I made a mistake creating the new OAuth 2.0 Client on the google console.
I checked the accessToken manually via:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=ya29.CjA8A7O96w-vX4OCSPm-GMEPGVIEu-RTeOxKy_75z6fbYVSXsdi9Ot3NmxlE-j_t-BI
{
"issued_to": "48168146---------.apps.googleusercontent.com",
"audience": "48168146---------.apps.googleusercontent.com",
"scope": "https://www.googleapis.com/auth/games_lite",
"expires_in": 879,
"access_type": "offline"
}
Is there something I do not see? Help is very much appreciated...
I found a root cause discussion inside the unity plugin "play-games-services" on github:
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1293
and
https://github.com/playgameservices/play-games-plugin-for-unity/issues/1309
It seems that google switching their authentication flow. In the given links they are talking about adding the email scope inside the plugin to get the idtoken again. I'll try that in the next days and share my experience.
Here is a good explaination about what happens:
http://android-developers.blogspot.de/2016/01/play-games-permissions-are-changing-in.html
If you do what paulsalameh said here (Link to Github) it will work again:
paulsalameh: Sure. After you import the unitypackage, download NativeClient.cs and
PlayGamesClientConfig.cs from my commits (#1295 & #1296), and replace
them in the correct locations.
Afte that "unity play-services-plugin" code update you will be able to add AddOauthScope("email") to PlayGamesClientConfiguration, which allows your server to get the idtoken with the serverAuthCode again...
Code snippet from Unity:
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
.AddOauthScope("email")
.AddOauthScope("profile")
.Build();
Now I am back in business:
{
"access_token" : "ya29.Ci8..7kBR-eBdPw1-P7Pe8QUC7e_Zv7qxCHA",
"expires_in" : 3600,
"id_token" : "eyJhbGciOi......I1NiE0v6kqw",
"refresh_token" : "1/HlSZOo......dQV1y4E",
"token_type" : "Bearer"
}
I have created an MVC application in visual studio 2013 using Visual Basic and when the user logs into the application it will either display the log In failed view or continue to the submit Issue view. All of this was correctly working when I used a local SQL Server database on the machine as it redirected correctly to all views.
But now that I have to publish the application and use an actual live SQL Database Sever not on the machine. The problem is that it will not redirect to the Submit Issue Page.
The Log In failure HTTP Post will return the Result number 200 (success) but the Submit Issue HTTP Post will return the Result number 302 (redirect Issue).
The application successfully can retrieve information from the live Database because when I compare the Log In details with the details in the Database like this:
Dim userdetailLocal = (From data In usertable.UserTables Where data.username = user.username AndAlso data.userPassword = user.userPassword Select data.username)
If (userdetailLocal.Count() > 0) Then
Return RedirectToAction("SubmitIssue")
Else
Return RedirectToAction("LogInFailure")
End If
This successfully navigates to either of the options when the details are incorrect or correct.
But only the "LogInFailure" View will successfully return like this:
Public Function LogInFailure() As ActionResult
Return View()
End Function
The "submitIssue" view will return this error:
"The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies."
But the view is basically the same as the other the only difference is that the "submitIssue" view contains other information on it that is required to post an Issue. The only view that works that contains information required to post information is the "Log In" view.
Public Function SubmitIssue() As ActionResult
Return View()
End Function
<HttpPost()>
<AllowAnonymous>
<Authorize>
<ValidateAntiForgeryToken()>
Public Function SubmitIssue(<Bind(Include:="IssueID,IssueName,IssueSummary")>
ByVal issuetable As IssueTable, command As String, objModelMail As IssueTable) As ActionResult
Return Redirect("Success")
End Function
Then my connection string is:
add name="##connectionString##"
connectionString="metadata=res://*/IssueConnectionString.csdl|res://*/IssueConne ctionString.ssdl|res://*/IssueTracker.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=SERVER\SQLSERVERTEST;
initial catalog=SERVERDATABASE;
persist security info=False;
user id=USER;
pwd=PWDID;
integrated security=False;
workstation id=WORKSTATION;
packet size=****;
MultipleActiveResultSets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
I think it is to do with the permissions of the database but I am not sure does anyone know with I get this redirect error when using the Server Database but not a local database?
I also think that the redirect loop is coming from the browser successfully load the page again and again. But it cannot actually retrieve the view hence why FireFox is displaying that error message. The Network tool for the submitIssue view will return the following:
SubmitIssue
302 - POST - LogIn
200 - POST - abort?transport=longPolling&connectionToken=AQAAANC...
302 - GET - submitIssue
302 - GET - HttpError500
302 - GET - NotFound
302 - GET - NotFound (repeated infinitely)
LoginFailure
302 - POST - LogIn
200 - POST - abort?transport=longPolling&connectionToken=AQAAANC....
200 - GET - LogInFailure
200 - GET - broswerLink
200 - GET - negotiate?requestURL=http://...
I got my application working on the server by adding the following information to my application. The reason why I was getting a redirect loop was because there was a few bits of information missing that I needed to add that prevented the view from being correctly loaded.
In the submitIssue (GET Request) I added these viewbag's information:
ViewBag.issueTypeID = New SelectList(dbServer.IssueTypeTables, "IssueTypeID", "IssueTypeName")
ViewBag.priorityID = New SelectList(dbServer.PriorityTables, "priorityID", "severity")
This allowed the controller to read in the two ID's above which was one of the reasons that it was skipping over the view.
The second thing that I done to solve the issue was to add more information in the submitIssue (POST request).
Public Function SubmitIssue(<Bind(Include:="IssueID,IssueSummary,IssueTypeID,priorityID")>
issuetable As IssueTable, command As String, objModelMail As IssueTable) As ActionResult
Adding both of these to my applications enabled me to get all the views to successfully return Status of 200 (success) and prevent a redirect loop.
I'm trying to create a user with the DNN 7 services framework. I've taken my working code from my custom registration module and modified to work within a DNN webapi function.
When I get to the UserController.CreateUser call in the code below I receive a
"\"There was an error generating the XML document.\""
exception. My user makes it into the aspnet_Users table and the DNN users table but does not make it into the DNN userportals table. Any ideas would be appreciated.
private void CreateUser()
{
//Update DisplayName to conform to Format
UpdateDisplayName();
User.Membership.Approved = PortalSettings.UserRegistration == (int)Globals.PortalRegistrationType.PublicRegistration;
var user = User;
CreateStatus = UserController.CreateUser(ref user);
I finally found the issue. I was not setting the portal ID for my new users and DNN was excepting out when it was adding them to a portal. All it took was User.PortalId = 0 before the CreateUser call.
I have found by trial and error that the minimum needed to create a viable DNN user is:
UserInfo uiNewUser = new UserInfo();
uiNewUser.Username = "<myUsername>";
uiNewUser.Displayname = "<myDisplayname>";
uiNewUser.Email = "<myUserEmail>";
UserMembership newMembership = new UserMembership(uiNewUser);
newMembership.Password = "<myUserPassword>";
uiNewUser.Membership = newMembership;
uiNewUser.PortalID = <myPortalID>;
DotNetNuke.Security.Membership.UserCreateStatus uStatus;
uStatus = DotNetNuke.Security.Membership.MembershipProvider.Instance().CreateUser(ref uiNewUser);
RoleInfo newRole = RoleController.Instance.GetRoleByName(uiNewUser.PortalID, "Registered Users");
RoleController.Instance.AddUserRole(uiNewUser.PortalID, uiNewUser.UserID, newRole.RoleID, (RoleStatus)1, false, DateTime.MinValue, DateTime.MaxValue);
If any of these are missed out, parts of the user are created in the database, but the user may not be visible in the Admin list of users, or an Exception may be generated. Other details can be added later.