Search Results

Search found 6862 results on 275 pages for 'username'.

Page 19/275 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Killing Mysql prcoesses staying in sleep command.

    - by Shino88
    Hey I am connecting a MYSQL database through hibernate and i seem to have processes that are not being killed after they are finished in the session. I have called flush and close on each session but when i check the server the last processes are still there with a sleep command. This is a new problem which i am having and was not the case yesterday. Is there any way i can ensure the killng of theses processes when i am done with a session. Below is an example of one of my classes. public JSONObject check() { //creates a new session needed to add elements to a database Session session = null; //holds the result of the check in the database JSONObject check = new JSONObject(); try{ //creates a new session needed to add elements to a database SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); if (justusername){ //query created to select a username from user table String hquery = "Select username from User user Where username = ? "; //query created Query query = session.createQuery(hquery); //sets the username of the query the values JSONObject contents query.setString(0, username); // executes query and adds username string variable String user = (String) query.uniqueResult(); //checks to see if result is found (null if not found) if (user == null) { //adds false to Jobject if not found check.put("indatabase", "false"); } else { check.put("indatabase", "true"); } //adds check to Jobject to say just to check username check.put("justusername", true); } else { //query created to select a username and password from user table String hquery = "Select username from User user Where username = :user and password = :pass "; Query query = session.createQuery(hquery); query.setString("user", username); query.setString("pass", password); String user = (String) query.uniqueResult(); if(user ==null) { check.put("indatabase", false); } else { check.put("indatabase", true); } check.put("justusername", false); } }catch(Exception e){ System.out.println(e.getMessage()); //logg.log(Level.WARNING, " Exception", e.getMessage()); }finally{ // Actual contact insertion will happen at this step session.flush(); session.close(); } //returns Jobject return check; }

    Read the article

  • How to change a Datasource's username/password at runtime in a J2EE app?

    - by Toto
    I've deployed a web-module which connects to the database via a datasource configured in the J2EE application server. Currently, the user/password for the database connection is set in the proper J2EE application server's datasources configuration file. I want to change during runtime the datasource's user/password. (e.g.: implement a new web form in which the user is asked to enter de user/password to be used in the database connection). Is there a standard way to do that in J2EE applications or it depends on the J2EE application server? In this case I'm using Orion application server.

    Read the article

  • MySQL calling in Username to show instead of ID!

    - by Jess
    I have a users table, books table and authors table. An author can have many books, while a user can also have many books. (This is how my DB is currently setup). As I'm pretty new to So far my setup is like bookview.php?book_id=23 from accessing authors page, then seeing all books for the author. The single book's details are all displayed on this new page...I can get the output to display the user ID associated with the book, but not the user name, and this also applies for the author's name, I can the author ID to display, but not the name, so somewhere in the query below I am not calling in the correct values: SELECT users.user_id, authors.author_id, books.book_id, books.bookname, books.bookprice, books.bookplot FROM books INNER JOIN authors on books.book_id = authors.book_id INNER JOIN users ON books.book_id = users.user_id WHERE books.book_id=" . $book_id; Could someone help me correct this so I can display the author name and user name both associated with the book! Thanks for the help :)

    Read the article

  • What is the best way to password protect folder/page using php without a db or username

    - by Salt Packets
    What is the best way to password protect folder using php without a database or user name but using. Basically I have a page that will list contacts for organization and need to password protect that folder without having account for every user . Just one password that gets changes every so often and distributed to the group. I understand that it is not very secure but never the less I would like to know how to do this. In the best way. It would be nice if the password is remembered for a while once user entered it correctly.

    Read the article

  • How to handle dynamic role or username changes in JSF?

    - by roadrunner
    I have a JSF application running on glassfish 2.1 with a EJB 3 backend. For authentication I use a custom realm. The user authenticates using the e-mail-address and password he specified on registration. Everything is working quite well. Now I have two related problems: 1) The user can edit his profile and -- naturally -- he can also change his e-mail-address. Unfortunately when I perform operations based on the current user's identity using ExternalContext.getUserPrincipal().getName(), I will receive the previous e-mail-address the user used on login. At the moment I handle this by forcing the user to reauthenticate after he changed his e-mail-address, but is there another more graceful possibility? 2) Same for user roles. E.g. I have the user roles MEMBER and PREMIUM_MEMBER. A MEMBER may become a PREMIUM_MEMBER during his current session. Unfortunately the role seems to be only determined at login. Is there any possibility, that JSF and EJB recognize the new user role without the need for the user to re-authenticated?

    Read the article

  • Killing Mysql processes staying in sleep command.

    - by Shino88
    Hey I am connecting a MYSQL database through hibernate and i seem to have processes that are not being killed after they are finished in the session. I have called flush and close on each session but when i check the server the last processes are still there with a sleep command. This is a new problem which i am having and was not the case yesterday. Is there any way i can ensure the killng of theses processes when i am done with a session. Below is an example of one of my classes. public JSONObject check() { //creates a new session needed to add elements to a database Session session = null; //holds the result of the check in the database JSONObject check = new JSONObject(); try{ //creates a new session needed to add elements to a database SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); session = sessionFactory.openSession(); if (justusername){ //query created to select a username from user table String hquery = "Select username from User user Where username = ? "; //query created Query query = session.createQuery(hquery); //sets the username of the query the values JSONObject contents query.setString(0, username); // executes query and adds username string variable String user = (String) query.uniqueResult(); //checks to see if result is found (null if not found) if (user == null) { //adds false to Jobject if not found check.put("indatabase", "false"); } else { check.put("indatabase", "true"); } //adds check to Jobject to say just to check username check.put("justusername", true); } else { //query created to select a username and password from user table String hquery = "Select username from User user Where username = :user and password = :pass "; Query query = session.createQuery(hquery); query.setString("user", username); query.setString("pass", password); String user = (String) query.uniqueResult(); if(user ==null) { check.put("indatabase", false); } else { check.put("indatabase", true); } check.put("justusername", false); } }catch(Exception e){ System.out.println(e.getMessage()); //logg.log(Level.WARNING, " Exception", e.getMessage()); }finally{ // Actual contact insertion will happen at this step session.flush(); session.close(); } //returns Jobject return check; }

    Read the article

  • how to get my program to enter windows username password?

    - by blood
    i have been working on a program that will enter usernames and passwords if someone plugs in a Usb, but i don't know how to enter a windows log in password. So the idea is to have my program running so it can find if the usb is plugged in if so it will use keybd_event to enter the password and to hit enter. how would i get my program to run so i can do this?

    Read the article

  • In order to bypass a website's login screen, can you load a link with a username and password?

    - by Jeff
    I am relatively new to web development, and I was hoping I could get some pointers about the feasibility of a feature I would like to implement. Is it possible to have a url link that you can click on, that can contain login credentials for the website it is linking to, so as to bypass that websites login screen? In other words, can I make a link from my website to facebook, that would allow me to login right in to my facebook, from any computer? Meaning, if I don't have cookies to store my login info in, is it possible to login still? This is just a conceptual question, so any help would be appreciated! Thanks!

    Read the article

  • How can I find out the original username a process was started with?

    - by szabgab
    There is a perl script that needs to run as root but the we must make sure the user who runs the script did not log-in originally as user foo as it will be removed during the script. So how can I find out if the user, who might have su-ed several times since she logged in has not impersonated 'foo' at any time in that chain? I found an interesting perl script that was calling the following two shell scripts, but I think that would only work on Solaris. my $shell_paren = `ps -ef | grep -v grep | awk \'{print \$2\" \"\$3}\' | egrep \"^@_\" | awk \'{print \$2}'`; my $parent_owner = `ps -ef | grep -v grep | awk \'{print \$1\" \"\$2}\' | grep @_ | awk \'{print \$1}\'`; This needs to work on both Linux and Solaris and I'd rather eliminate the repeated calls to he the shell and keep the whole thing in Perl.

    Read the article

  • Is there an easy way to add a secure file upload form (username, password, select file) to a website

    - by user346602
    Hi, I am very new to website design. Have an architect who wants his clients to enable his clients to upload (ftp - but don't know if http could be a better alternative?) files (plans etc.) to him, through the website I'm designing for him. I have seen similar things available on printers websites... I have seen uploadify, but it requires flash (I can only code HTML, CSS and a tiny bit of PHP), and don't think it is a secure option. I have also seen net2ftp, but don't really understand how it works. Any direction would be sincerely appreciated.

    Read the article

  • Get with the ajax data into a php file

    - by Max Torstensson
    I'm trying to build a login system with ajax and php. I use a log-view where I then save the data in ajax which brings into my doLogin.php (php file). My problem is that php file should never be any ajax data for when I build it into a class and a function VIEW: public function DoLoginBox() { //inloggning form-tagg... return '<p>&nbsp;</p> <div id="content"> <h1>Login Form</h1> <form id="form1" name="form1" action="Handler/doLogin.php" method="post"> <p> <label for="username">Username: </label> <input type="text" name="username" id="username" /> </p> <p> <label for="password">Password: </label> <input type="password" name="password" id="password" /> </p> <p> <input type="submit" id="login" name="login" /> </p> </form> <div id="message"></div> </div>'; } AJAX: <script type="text/javascript"> $(document).ready(function() { $("#login").click(function() { var action = $("#form1").attr('action'); var form_data = { username: $("#username").val(), password: $("#password").val(), is_ajax: 1 }; $.ajax({ type: "POST", url: action, data: form_data, success: function(response) { if(response == 'success') $("#form1").slideUp('slow', function() { $("#message").html("<p class='success'>You have logged in successfully!</p>"); }); else $("#message").html("<p class='error'>Invalid username and/or password.</p>"); } }); return false; }); }); </script PHP: <?php require_once ("UserHandler.php"); class DoLogingHandler{ public function Login (){ $is_ajax = !empty($_REQUEST['is_ajax']); if(isset($is_ajax) && $is_ajax) { $username = $_REQUEST['username']; $password = $_REQUEST['password']; $UserHandler = new UserHandler(); $UserHandler -> controllDB($username,$password); if($username == 'demo' && $password == 'demo') { echo "success"; } } } } ` $DoLogingHandler = new DoLogingHandler(); $DoLogingHandler-Login(); ?

    Read the article

  • Davical + LDAP + NTLM

    - by slavizh
    I have set up a Davical server on CentOS. I've configured it to use LDAP and the users use their usernames and passwords to authenticate to the Davical server. I am using Lightning as client software for calendaring. Using Lightning requires entering username and password everytime, so I decided to set NTLM. I want my users who are logging in the domain to use the calendar server trough Lightning without entering username and password. I've set up NTLM on the Davical server. But when a user trys to reach the calendar trough Lightning first the server asks for NTLM username and password and then ask for the LDAP username and password. It becomes something like double authentication. The problem is that NLTM requires domain\username and passowrd and Davical trough LDAP requires only username and password. So my questions are: Is there a way to change something in Davical so that Davical trough LDAP to requires domain\username and passwords authentication? That way may be trough NTLM the second authentication will proceed silently and the users will user Lightning without entering usernames and passwords Is there a way I can make this double authentication to become one and to use only NTLM? P.S. We have Samba domain with LDAP server and our users use Thunderbird for their mail and I want to put Lightning too. That way they will have calendar service. But I don't want they to enter username and password for the calendar every time they log in. I know they can save that password but that is not an option for my organization.

    Read the article

  • How to Access User Directory shared by Apache on OS X Mountain Lion?

    - by schluchc
    When trying to access the local user web page on localhost/~username, I get a "403 Forbidden". The system web page in /Library/WebServer/Documents is accessible on localhost/ though, so I assume Apache is working fine. I know that this problem has been discussed several times, also on superuser. I implemented and checked all I could find, but I still couldn't solve the problem and would be glad if someone had a suggestion for this particular case: sudo apachectl -t returns Syntax OK. I have a username.conf file in /etc/apache2/users/: <Directory "/Users/username/Sites/"> Options Indexes MultiViews FollowSymLinks AllowOverride AuthConfig Limit Order allow,deny Allow from all </Directory> as proposed here [SuperUser] and in several other tutorials. The permissions of the username.conf file are -rw-r--r-- root wheel, as they should be. The httpd.conf is unchanged and therefore contains the line Include /private/etc/apache2/extra/httpd-userdir.conf. That file in turn contains UserDir Sites Include /private/etc/apache2/users/*.conf <IfModule bonjour_module> RegisterUserSite customized-users </IfModule> So the httpd*.conf files should be ok. The permissions of /Users/username/Sites is drwxr-xr-x 10 username staff and -rw-r--r--@ 1 username staff for the index.html. In the error log I simply get a [Sun Nov 25 22:14:32 2012] [error] [client 127.0.0.1] (13)Permission denied: access to /~username/ denied. And yes, after each change I did the sudo apachectl restart. Any help no how to solve the problem or how to further analyze it would be highly appreciated!

    Read the article

  • XMPP SASL authentication on Ejabberd with PHP

    - by bucabay
    I'm trying to authenticate with an XMPP server using SASL. /** * Send Authentication, SASL * @return Bool * @param $username String * @param $password String */ function authenticate($username, $password) { $this->username = $username; $this->password = $password; var_dump($username, $password, $this->domain); $auth = base64_encode($username.'@'.$this->domain."\u0000".$username."\u0000".$password); $xml = '<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">'.$auth.'</auth>'; if ($this->write($xml)) { if ($xml = $this->listen(1, true)) { if (preg_match("/<success/i", $xml)) { $this->authenticated = $this->_sendStream(); } } } $this->events->trigger('authenticate', $this->authenticated); return $this->authenticated; } The XMPP server however responds with: <failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><bad-protocol/></failure> This is against an Ejabberd server. When I open the XMPP stream, it advertises: <stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features> So it seams to me that SASL - PLAIN should work. I have a JavaScript version, that works perfectly on OpenFire server. (I can't test it on Ejabberd at the moment) sendAuthentication: function() { clearTimeout(XMPP.sendAuthentication_timer); var auth = Base64.encode(XMPP.username+'@'+XMPP.domain+'\u0000'+XMPP.username+'\u0000'+XMPP.password); mySocket.events.receive.observe(XMPP.receivedAuthSuccess, function() { mySocket.send('<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">' + auth + '</auth>'); }); } So I can't get why the PHP version is not working.

    Read the article

  • Membership.Updateuser not really updating the database.

    - by Shimrod
    Hi everybody, I'm currently working on a membership system for my web application, which is based on forms authentication from the framework. I created some users with the integrated tool, and the login is perfectly working. But now what I want to do is to give administrator the capability to create, modify, delete users. So here is what I've got right now: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim muc As MembershipUserCollection = Membership.GetAllUsers() ComboBox1.DataSource = muc ComboBox1.DataValueField = "UserName" ComboBox1.DataTextField = "UserName" ComboBox1.DataBind() End Sub Protected Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles ComboBox1.SelectedIndexChanged Dim userName As String = ComboBox1.SelectedValue Dim mu As MembershipUser = Membership.GetUser(userName) Dim userRoles As String() = Roles.GetRolesForUser(userName) tbComments.Text = mu.Comment tbEmail.Text = mu.Email lblUserName.Text = mu.UserName End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim userName As String = ComboBox1.SelectedValue Dim mu As MembershipUser = Membership.GetUser(userName) If Not mu Is Nothing Then Try mu.Comment = tbComments.Text Membership.UpdateUser(mu) mu.Email = tbEmail.Text Membership.UpdateUser(mu) mu.IsApproved = True Membership.UpdateUser(mu) mu = Nothing Catch ex As Exception Console.WriteLine(ex.ToString()) End Try End If DetailPanel.Visible = False End Sub The problem is that the record doesn't seem to be updated in the database. I made the multiple calls to Membership.UpdateUser after reading this blog entry, but it didn't change anything. A strange think I noticed while debugging, is that when I enter the Button1_Click method, Membership.GetUser(userName) returns me values from my precedent attempt ! I don't really understand what I'm missing. Does someone have a clue ? Thanks in advance !

    Read the article

  • log in using fitnesse

    - by user1513027
    This is a basic HTTP encoding and formatting question. I need to log in from a RESTFixture to a PHP web service. I need to pass in the account, username, and password, as POST variables just as a login page does. Wireshark shows that my login page formats it as accountNumber=accounttest&username=usertest&password=passtest When I do that in the test, I get a POST array of $_POST: Array ( [accountNumber] => accounttest [amp;username] => usertest [amp;password] => passtest ) That would work but the "amp;" obviously makes it so that PHP doesn't find the username. Content type is the same for both live and the test. [CONTENT_TYPE] = application/x-www-form-urlencoded Here are a few other formats I've tried with results. In all three cases, it fails to parse so all fields end up in one array entry. input: accountNumber=accounttest%amp;username=usertest%amp;password=passtest Result: $_POST: Array ( [accountNumber] = accounttest%amp;username=usertest%amp;password=passtest ) input: accountNumber=accounttest;username=usertest;password=passtest Result: $_POST: Array ( [accountNumber] => accounttest;username=usertest;password=passtest ) input: accountNumber=accounttest%26username=usertest%26password=passtest Result: $_POST: Array ( [accountNumber] = accounttest&username=usertest&password=passtest ) So the last one correctly converts the %26 to &, but doesn't break the items apart into array elements.

    Read the article

  • Java reading xml element without prefix but within the scope of a namespace

    - by wsxedc
    Functionally, the two blocks should be the same <soapenv:Body> <ns1:login xmlns:ns1="urn:soap.sof.com"> <userInfo> <username>superuser</username> <password>qapass</password> </userInfo> </ns1:login> </soapenv:Body> ----------------------- <soapenv:Body> <ns1:login xmlns:ns1="urn:soap.sof.com"> <ns1:userInfo> <ns1:username>superuser</ns1:username> <ns1:password>qapass</ns1:password> </ns1:userInfo> </ns1:login> </soapenv:Body> However, how when I read using AXIS2 and I have tested it with java6 as well, I am having a problem. MessageFactory factory = MessageFactory.newInstance(); SOAPMessage soapMsg = factory.createMessage(new MimeHeaders(), SimpleTest.class.getResourceAsStream("LoginSoap.xml")); SOAPBody body = soapMsg.getSOAPBody(); NodeList nodeList = body.getElementsByTagNameNS("urn:soap.sof.com", "login"); System.out.println("Try to get login element" + nodeList.getLength()); // I can get the login element Node item = nodeList.item(0); NodeList elementsByTagNameNS = ((Element)item).getElementsByTagNameNS("urn:soap.sof.com", "username"); System.out.println("try to get username element " + elementsByTagNameNS.getLength()); So if I replace the 2nd getElementsByTagNameNS with ((Element)item).getElementsByTagName("username");, I am able to get the username element. Doesn't username have ns1 namespace even though it doesn't have the prefix? Am I suppose to keep track of the namespace scope to read an element? Wouldn't it became nasty if my xml elements are many level deep? Is there a workaround where I can read the element in ns1 namespace without knowing whether a prefix is defined?

    Read the article

  • Struts2 Hibernate Login with User table and group table

    - by J2ME NewBiew
    My problem is, i have a table User and Table Group (this table use to authorization for user - it mean when user belong to a group like admin, they can login into admincp and other user belong to group member, they just only read and write and can not login into admincp) each user maybe belong to many groups and each group has been contain many users and they have relationship are many to many I use hibernate for persistence storage. and struts 2 to handle business logic. When i want to implement login action from Struts2 how can i get value of group member belong to ? to compare with value i want to know? Example I get user from username and password then get group from user class but i dont know how to get value of group user belong to it mean if user belong to Groupid is 1 and in group table , at column adminpermission is 1, that user can login into admincp, otherwise he can't my code: User.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.dejavu.software.model; import java.io.Serializable; import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.Table; import javax.persistence.Temporal; /** * * @author Administrator */ @Entity @Table(name="User") public class User implements Serializable{ private static final long serialVersionUID = 2575677114183358003L; private Long userId; private String username; private String password; private String email; private Date DOB; private String address; private String city; private String country; private String avatar; private Set<Group> groups = new HashSet<Group>(0); @Column(name="dob") @Temporal(javax.persistence.TemporalType.DATE) public Date getDOB() { return DOB; } public void setDOB(Date DOB) { this.DOB = DOB; } @Column(name="address") public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Column(name="city") public String getCity() { return city; } public void setCity(String city) { this.city = city; } @Column(name="country") public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } @Column(name="email") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name="usergroup",joinColumns={@JoinColumn(name="userid")},inverseJoinColumns={@JoinColumn( name="groupid")}) public Set<Group> getGroups() { return groups; } public void setGroups(Set<Group> groups) { this.groups = groups; } @Column(name="password") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Id @GeneratedValue @Column(name="iduser") public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } @Column(name="username") public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Column(name="avatar") public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } } Group.java /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.dejavu.software.model; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; /** * * @author Administrator */ @Entity @Table(name="Group") public class Group implements Serializable{ private static final long serialVersionUID = -2722005617166945195L; private Long idgroup; private String groupname; private String adminpermission; private String editpermission; private String modpermission; @Column(name="adminpermission") public String getAdminpermission() { return adminpermission; } public void setAdminpermission(String adminpermission) { this.adminpermission = adminpermission; } @Column(name="editpermission") public String getEditpermission() { return editpermission; } public void setEditpermission(String editpermission) { this.editpermission = editpermission; } @Column(name="groupname") public String getGroupname() { return groupname; } public void setGroupname(String groupname) { this.groupname = groupname; } @Id @GeneratedValue @Column (name="idgroup") public Long getIdgroup() { return idgroup; } public void setIdgroup(Long idgroup) { this.idgroup = idgroup; } @Column(name="modpermission") public String getModpermission() { return modpermission; } public void setModpermission(String modpermission) { this.modpermission = modpermission; } } UserDAO /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.dejavu.software.dao; import java.util.List; import org.dejavu.software.model.User; import org.dejavu.software.util.HibernateUtil; import org.hibernate.Query; import org.hibernate.Session; /** * * @author Administrator */ public class UserDAO extends HibernateUtil{ public User addUser(User user){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); session.save(user); session.getTransaction().commit(); return user; } public List<User> getAllUser(){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); List<User> user = null; try { user = session.createQuery("from User").list(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } session.getTransaction().commit(); return user; } public User checkUsernamePassword(String username, String password){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); User user = null; try { Query query = session.createQuery("from User where username = :name and password = :password"); query.setString("username", username); query.setString("password", password); user = (User) query.uniqueResult(); } catch (Exception e) { e.printStackTrace(); session.getTransaction().rollback(); } session.getTransaction().commit(); return user; } } AdminLoginAction /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package org.dejavu.software.view; import com.opensymphony.xwork2.ActionSupport; import org.dejavu.software.dao.UserDAO; import org.dejavu.software.model.User; /** * * @author Administrator */ public class AdminLoginAction extends ActionSupport{ private User user; private String username,password; private String role; private UserDAO userDAO; public AdminLoginAction(){ userDAO = new UserDAO(); } @Override public String execute(){ return SUCCESS; } @Override public void validate(){ if(getUsername().length() == 0){ addFieldError("username", "Username is required"); }if(getPassword().length()==0){ addFieldError("password", getText("Password is required")); } } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getRole() { return role; } public void setRole(String role) { this.role = role; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } } other question. i saw some example about Login, i saw some developers use interceptor, im cant understand why they use it, and what benefit "Interceptor" will be taken for us? Thank You Very Much!

    Read the article

  • Sending a password securely using gwt and app engine?

    - by user246114
    Hi, I set up session handling on a google app project. This is supposed to allow my users to login and maintain state across pages. I just dumped it into the default greeting service to try it out: public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService { public void sessionTest(String username) { HttpSession session = getThreadLocalRequest().getSession(false); session.setAttribute("username", username); } } then attempting to pull it out in my landing project.jsp page: <% String username = null; HttpSession mysession = request.getSession(false); if (mysession.getAttribute("username") != null) { username = (String)mysession.getAttribute("username"); } else { username = "(not logged in yet)"; } <p>You are: <%= username %> </p> %> It works, but I don't know how to send the data in sessionTest() securely. If I were sending the user's password in there too, it would be in the clear. This would be ok (I think) if I was using https, but google app engine does not allow you to use https under custom domains (like www.mysite.com), they have to be under the (mysite.appspot.com) domain. I'm kind of stuck here - how do we send passwords securely? If I was using php, I think I could use digest authentication (I'm not too experienced here) - can we do something like that with gwt + gae? Thanks

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >