I'm working on an auto auth system. Basicly when you log in it store your data into internal storage to automatically log you next time.
I have an issue because I need to perform 2 click to log a user so to auto log him I do that:
String username = data.substring(0,separatorPostion);
String passwd = data.substring(separatorPostion+1);
username_input.setText(username);
passwd_input.setText(passwd);
Log.w("DEBUG usrNameParsed: ",username);
Log.w("DEBUG passParsed: ",passwd);
((View) findViewById(R.id.next_btn_username)).performClick();
((View) findViewById(R.id.next_btn_passwd)).performClick();
But, it crash. I can make the first perform click or the second one alone they both work but not together. For the purpose I need those 2 clicks because it's part of my auth system.
Thanks guys.
EDIT:
There is no real crash log this is what I get:
Related
I writing a simple google web app. this .gs basically open a html file that require user to input his name then click. after the user clicked it, the function checkGCR() should log the username in logger.log. but nothing show in logger.log. if run the function checkGCR(), the log does record "null" since nothing input in the input box. One thing I notice is eventhough the logger.log didn't show anything, but stackdriver log doesn't showing something going on there. Please check my code is that something wrong I did here because I follow online tutorial with exact same coding but logger.log just doesn't seem to work.
//This is code.gs
function checkGCR(myid){
Logger.log(myid);
}
//This is html
document.getElementById("btn").addEventListener("click", doStuff);
function doStuff(){
var myid=document.getElementById("mykidid").value;
google.script.run.checkGCR(myid);
}
I just found out that eventhough it doesn't show up at Logger.log, but it does show up in Stackdriver log. So I just use that instead.
I am trying to write an application which would offer user to manage users on LDAP system. One feature of this is the functionality "Forgot Password".
User uses my app to Reset his password
I ask some security questions and if they are correct, I redirect him to new screen - new password screen.
User provides new password only (as he has forgotten his old one)
I use admin Context and reset the user password (using modifyAttributes(..)).
The LDAP system, set pwdReset to true indicating that password was changed by admin and must be changed by user.
Now, I do want to set this to false, coz I don't want user to change his password again (as he already did in above steps), so I explicitly modify it to false. But I get error
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - Object Class Violation]; remaining name 'cn=XXXX,ou=XXXXOU,O=XXXX'
What is the way around ? Is there some other alternative ?
For refernce, the code to reset pwdReset is as under:
List<ModificationItem> modsList = new ArrayList<ModificationItem>();
BasicAttribute attribute = new BasicAttribute(ATTR_PASSWORDRESET, "false");
modsList.add(new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attribute));
ModificationItem [] modsArr = modsList.toArray(new ModificationItem[modsList.size()]);
modsArr = modsList.toArray(new ModificationItem[modsList.size()]);
this.adminCtx.modifyAttributes(userName, modsArr);
And here is my pwdPolicy
I've just spent two weeks proving to myself that OpenLDAP doesn't actually do step #5 at all, despite what the wording of the RFC draft appears to mean. I als found a message in the OpenLDAP Mail archives confirming that they think it isn't supposed to do that. So what is happening is that there is no pwdReset attribute to set to false, so you're getting a schema violation trying to add it with that value. So, all you have to do is nothing.
It would probably be safer just to set pwdReset to null, which removes it completely, or just remove it with DirContext.REMOVE_ATTRIBUTE. My code doesn't use ModificationItem, which is another clue, more like:
BasicAttributes attributes = new BasicAttributes(ATTR_PASSWORDRESET, null);
this.adminCtx.modifyAttributes(userName, attrs);
The above also means that if you want it set to TRUE you have to do so yourself.
At the moment , im working with java gwt and i stopped studdenly because one problem occured. I want that my information (for example string) will save after refresh button is clicked.
// user enters something in TextArea textArea1 object
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
//maybe there is a function or what
pleaseSaveInfomation(textArea1);
}
});
I tried this , but i know how to implement it correctly to my source code:
https://stackoverflow.com/a/14220746/5010218
The last(worst) chance is to store data from textArea in file.txt , after refreshing i could read info from file and thats all. But maybe GWT has a specific handler/method/class or what to handle this.
Thats for your opinion and help.
I had the same problem. You can easily overcome it with this.
import com.google.gwt.storage.client.Storage;
private Storage stockStore = null;
stockStore = Storage.getLocalStorageIfSupported();
Please read documentation
http://www.gwtproject.org/doc/latest/DevGuideHtml5Storage.html#UsingStorage
When a browser close a window (because of a refresh, or the user has closed the window, changed the url, etc), a script is not allowed to prevent this action. It's not specific to GWT.
However, you can suggest to the browser-agent to show a confirmation to the user. You can do this with the message property of the closing event.
In GWT:
Window.addWindowClosingHandler(new Window.ClosingHandler() {
public void onWindowClosing(Window.ClosingEvent closingEvent) {
closingEvent.setMessage("Confirm ?");
}
});
You shouldn't rely on this event to store your data, as a lot of condition can prevent you to do this. You should maybe periodically store a draft to the local-storage or to the server.
You probably want to store your data in sessionStorage. In GWT, this the Storage class.
Recently, I've added leaderboards to my Android project and everything worked fine until I tried to submit score to it. Google Play Services are configured correctly and I can view the leaderboard but I cannot submit
Games.Leaderboards.submitScoreImmediate(getApiClient(),String.valueOf(R.string.leaderboard_id), score);
Since i doubt error is visibe from that line and since logcat displays no data related to score submission, i am wondering how to check is the score was submitted correctly.
Thanks.
I don't know much about the score submission to the Leaderboards - but the error might be visible from your line:
String.valueOf(R.string.leaderboard_id)
is not giving you the string you specified in the some strings.xml file, but some string containing the internal android id for that String like "1234567". To get the String from the file you should use
getContext().getString(R.string.leaderboard_id)
I am currently trying to enhance the To-Do List tutorial from Play framework's website. I've added a login form, (and of course a User class acting as a model), and it works perfectly well. I also made a small "dashboard" in which the logged user is able to change his password and his email address. But when I submit the form, I get a "Datasource user is null ?" error (RuntimeException).
The whole problem came when I wanted to restrict the edition possibilities (I first used a whole User form, which is quite over the top (User do not need to edit their ID). So I made a small inner class in my Application file called UpdateUser which gathers the required informations, just as I did for the login system.
Searching this error gave me many results but people saw their problem fixed by uncommenting the ebean.default line in the conf file, which I already did.
Here is the method I used to update user's informations :
Firstly, I made a small class in my Application to hold the form (exactly like I did for the login thing).
Then I made a update function as found here in my user class :
public static String update(String id, User newuser) {
newuser.update(id);
return("Your profile has been updated");
}
which returns the String that will be in my flash and which is according to my compiler the problem function.
This function is called in my Application like this :
public static Result updateUser(String id)
{
Form<UpdateUser> filledForm = updateUserForm.bindFromRequest();
System.out.println("Updated User : "+filledForm.get().id);
if(filledForm.hasErrors())
{
flash("success","Error while updating");
}else{
User user = new User(filledForm.get().id, filledForm.get().email, User.find.byId(filledForm.get().id).name, User.find.byId(filledForm.get().id).surname, filledForm.get().password);
flash("success", User.update(id,user));
}
return redirect(routes.Application.dashboard());
}
I tracked the data in the Form and it is not null (I mean I can get everything from the form). But I wonder if I have to create another ebean or if it's my function which is wrong. I also wonder if it's not my User creation that fail. Or maybe I should take the updateUser function and put it in my inner UpdateUser class ?
I have to admit that I worked on that all of yesterday (and probably today too), and I can't find anything on the internet except the ebean.default thing.
------EDIT
I continued to search, so here's what I tried :
1) Getting the form result into an instance of UpdateUser in order to use it
2) Use this instance instead of getting the data from the form
But it failed too. What's really weird is that I've added a toString() method for User class, and calling it on the user I want to insert (as an update) gives me the full stuff. I think it must be a configuration problem, but I can't see it.
Another thing : when I come to the error page and when I try to come back to the application by modifying the URL, I am disconnected. Is it my ebean that closes himself ?
Last edit for the day, I'm getting tired of this. I tried to delay the action (i.e. making it happen after the user has logged out), the new data are correctly saved but I still get the error when calling the update function.
Alright, I finally found it, but totally by chance.
I just had to write this :
public static String update(String id, User user) {
user.update((Object)id);
return ("Your profile has been updated");
}
Because for some reason that I don't really understand, The id String needs to be cast to Object. The rest of the code was correct. But apparently, when using update() on this particular case (is it because my id is a String or because I get the informations from another class before using it as my Model), the parameter which is supposed to be a String (even in the documentation) HAS to be cast.
That's it.