Howtos:AdminWebApp
From Red5Tutorials
As you know you can login Admin webApp using by default "admin" as username and "password" as password, if you just want to change the password you could use this jsp:
changePwd.jsp
<%@ page language="java" import = "org.springframework.security.providers.encoding.*,org.apache.derby.jdbc.*,javax.sql.*,java.sql.*" %> <% if(request.getParameter("cambia")!=null){
String prop = System.getenv("DERBY_HOME");
if (prop == null) {
prop = System.getProperty("user.home");
}
System.setProperty("derby.system.home", prop);
Connection conn = null;
Statement stmt = null;
try {
// JDBC stuff
DataSource ds = null;
try {
Object o = null;
if (o == null) {
EmbeddedDataSource eds = new EmbeddedDataSource();
eds.setCreateDatabase("create");
eds.setDatabaseName("Admin");
eds.setPassword("APP");
eds.setUser("APP");
ds = eds;
} else {
ds = (DataSource) o;
}
} catch (Exception e) {
out.println("Context check for datasource " + e.getMessage() );
}
//create the db and get a connection
conn = ds.getConnection();
//make a statement
stmt = conn.createStatement();
String user = request.getParameter("username");
String password = request.getParameter("password");
String newPassword = request.getParameter("newPassword");
Md5PasswordEncoder md5 = new Md5PasswordEncoder();
password = md5.encodePassword(password, "seKret").toString();
newPassword = md5.encodePassword(newPassword, "seKret").toString();
//update
stmt.execute("Update APPUSER set password = '"+newPassword+"' WHERE username='"+user+"' and password = '"+password+"'");
} catch (Exception e) {
out.println("Error in db setup " + e.getMessage());
} finally {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
}
}
}
} %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>
<title>Red5 Admin</title> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" /> <style type="text/css" media="screen">
html, body, #containerA, #containerB { height: 100%; } .formbg { background-color: rgb(238, 238, 238); } .formtable { border: 2px solid rgb(183, 186, 188); }
.formtext { font-family: Arial,Helvetica,sans-serif;
font-size: 12px; color: rgb(11, 51, 73);
}
body { margin: 0pt; padding: 0pt; overflow: hidden; background-color: rgb(250, 250, 250); } .error {
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
color: red;
}
</style>
</head> <body>
| <img style="width: 136px; height: 54px;" alt="" src="assets/logo.png" /> | |||||||||||
|
</body>
</html>
Just put it in the admin webapp folder and go to http://yourServer/admin/changePwd.jsp
It's just a 5 minutes JSP! You better use MVC pattern! ;)

